I have the following code:
cin >> r >> c;
char map[c][r];
for(int i = 0; i < r; i++)
{
string line;
cin >> line;
for (int j = 0; j < c; ++j) {
map[j][i] = line[j];
}
}
int n;
cin >> n;
//cout << "first " << endl << map[0][0] << endl<< map[1][0] << endl<< map[2][0] << endl<< map[3][0] << endl;
pair<pair<int, int>, pair<int,int>> queries[n];
for (int k = 0; k < n; ++k) {
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
queries[n] = make_pair(make_pair(r1-1, c1-1), make_pair(r2-1, c2-1));
}
cout << "test" << endl;
I am experiencing a really weird issue, where my map array seems to lose all its data after the second for-loop. I have breakpoints on the lines "int n;" and "cout << "test << endl;"
On the first breakpoint, my char array is filled with the values i expect, but however on the second breakpoint, all the values in the char array is '\000'.
What could be causing this?