vector<int>::iterator ptr; for (ptr = ar.begin(); ptr < ar.end(); ptr++) { //do something at (*ptr) }