vector subscript out of range during compiling
You never add any elements to normal
before trying to use normal[i]
.
You haven't put anything into normal
. It sits as an empty vector until you put something into it.
You can fix this problem by giving it a new value each iteration
for (i = 0; i < 10; i++) {
normal.push_back(vector<int>());
for (j = 0; j < 10; j++) {
normal[i].push_back(j);
}
}
Also, your i
and j
were being initialized to 1
, but I'm fairly certain you meant 0
. I addressed this in my snippet.
Vector normal is empty. You can initialize vector as follow.
vector<vector<int>> normal(10, vector<int>());