Question PRG-CPP-0006
EasyWhat is the output of this program?
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cout << v.size();
return 0;
}
- A.
0
- B.
4
- C.
Show answer and explanation
Answer: D
push_back adds three elements, so size() is 3.