a) vector <int> :: const_iterator itr = v.rbegin();
b) vector <int> :: reverse_iterator itr = v.begin();
c) vector <int> :: iterator itr = v.begin();
d) vector <int> :: iterator itr = v.cbegin();
Which is the following is syntactically correct for vector
1 thought on “Which is the following is syntactically correct for vector<int> v?”
Leave a Comment
You must be logged in to post a comment.
c
Explanation: v.rbegin() returns itertor of reverse iterator therefore cannot be stored in const_iterator(type mismatch). Similarly v.begin() returns normal iterator therefore cannot be stored in reverse_iterator and v.cbegin() returns the const_iterator therefore cannot be stored in normal iterator.