For given vector iterators. Does this code compile? If it fails, please choose the lines on which it does.
vector<int> vec(3,1);
const std::vector<int>::iterator iter = vec.begin();
*iter = 10; //1
++iter;      //2
std::vector<int>::const_iterator iter2 = vec.begin();
*iter2 = 10;//3
++iter2;     //4
const_iterator don't allow you to change the values that they point to ( std::vector::const_iterator )
const std::vector::iterator - iterator isn’t allowed to point to something different, but the thing it points to may be modified.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes