Say I wrote
int** foo = NULL;
int nx = 22, ny = 17;
void matrixfunc(){
foo = new int*[nx];
for (int x = 0; x < nx; x++)
foo[x] = new int[ny];
}
and called matrixfunc();, but before I could delete it
for (int x = 0; x < nx; x++)
delete[] foo[x];
delete[] foo;
foo = NULL;
the code crashed. Do I have a memory leak?
Sam