Skip to content
Quiz · Containers and Iterators · lesson 6 of 11

Quiz — an iterator after push_back

What happens when the program reads *it after push_back?

C++
#include <iostream>
#include <vector>

int main() {
    std::vector<int> v{1, 2, 3};
    auto it = v.begin();
    v.push_back(4);
    std::cout << *it << '\n';
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way