VECTORS Question 10

Last Updated :
Discuss
Comments

What will the following code print?

C++
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    vector<int> v1 = {1, 2, 3};
    vector<int> v2;
    v2 = v1;
    v1[0] = 10;
    cout << v2[0];
    return 0;
}


Error

3

2

1

Share your thoughts in the comments