Fun with Pointers 1

Computer Science Level pending

Consider the following C++ code :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>
using namespace std;

int main() {

    vector<int> v;

    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    v.push_back(4);
    v.push_back(5);

    vector<int>::iterator it = v.begin();

    v.insert(v.begin(),6);

    printf("%d\n", *it);

    return 0;
}

What will the program outputs?

×

Problem Loading...

Note Loading...

Set Loading...