I am creating a 2D array in C++. The code I use to do this is as follows
int** scopedata = new int*[1000];
for(int i=0; i<1000; i++){
scopedata[i] = new int[arraysize];
}
arraysize is an int with value 400. The problem I have is that when performing the code
cout << scopedata[999][500];
The value 0 is returned. I would expect a memory address error as the 500th element should not exist, if arraysize is 400. Can anyone shed some light on this for me? Is the 2D array being created actually larger than it should be?