CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #31

Vector push_back and size

easyVectors

📄 Code

Read carefully — what does this print?
1#include <iostream>
2#include <vector>
3using namespace std;
4int main() {
5 vector<int> v;
6 v.push_back(10);
7 v.push_back(20);
8 v.push_back(30);
9 cout << v.size() << " " << v[1] << endl;
10 return 0;
11}

🎯 Your Answer