how to delete memory of 2d dynamic array c++ code example
Example: delete 2d dynamic array c++
for (int i = 0; i < numRows; i++) {
delete [] world[i];
// world[i] = 0; // <- don't have to do this
}
delete [] world; // <- because they won't exist anymore after this
world = 0;