6 questions. Covers Jagged arrays and copying.
Questions 1 to 5 of 6
cpp #include <iostream> #include <vector> using namespace std; int main() { vector<vector<int>> a = {{1, 2}, {3, 4, 5}}; vector<vector<int>> b = a; b[1][2] = 9; cout << a[1][2] << "\n"; }
cpp #include <iostream> #include <vector> using namespace std; int main() { vector<vector<int>> c = {{7}, {8, 9}, {}}; int count = 0; for (const auto& row : c) { count += static_cast<int>(row.size()); } cout << count << " " << c.size() << "\n"; }
vector<vector<int>> b = a;
b[0][0]
a[0][0]
int*
new[]
5 question(s) left on this page.