here is my code
#include <iostream>
#include <string>
#include <vector>
using std::cout;
using std::vector;
int main() {
vector<vector<int>> map{{0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0}};
for (int j : map) {
for (int i :j) {
cout << i ;
}
cout << "\n";
}
}
Above code, there is an error in int j : map But when i change 'int' to 'auto', the code is working well
My question is what is proper type for 2d vector such as map? Why int is not working for 2d vector?