Can you explain this code working :-
for(vector :: iterator it = v.begin() ; it != v.end() ; it++) {
cout<<*it;
}
where v is an integer vector.
Can you explain this code working :-
for(vector :: iterator it = v.begin() ; it != v.end() ; it++) {
cout<<*it;
}
where v is an integer vector.
hey @VarIsh, v.begin() stores the address of first element of vector. v.end() stores the address of last element of vector. So we are beginning with first address and going to last address,*it will give values stored at that address.
No actually I am confused regarding this initialization part - “vector :: iterator it”. What type of variable it’s creating? Why the scope resolution operator is used?