What is the curious issue? There is no issue with i
or n
being out of bounds, just a crash when printing a value. Here is a minimal code example:
#include <iostream>
using namespace std;
int main()
{
int adj[1001][1001] = {{0}};
int D = 2;
for (int i=1; i<6; i++)
{
for (int j=0; j<D; j++)
{
int n = 3;
adj[i][n] = 2;
cout << adj[0][0] << endl;
}
}
return 0;
}
Compiled using LLVM CLang 3.5.0