Hello,
I've a 3x3 2D dynamic array allocated as below
int** matrix = new int* [3];
matrix[0] = new int [3*3];
for (int i = 1; i < 3; ++i)
matrix[i] = matrix[i-1] + 3;
How should I deallocate it? Is it correct:
delete [] matrix;
delete [] matrix[0];
Or should I also delete matrix[1]
, [2]
Greetings,