What will the following code print?
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v = {1, 2, 3, 4, 5};
for (int x : v)
x = x + 2;
for (int x : v)
cout << x << " ";
return 0;
}
1 2 3 4 5
2 4 6 8 10
2 4 5 6 7
Compiler Error
This question is part of this quiz :
C++ Vector