I was always wondering if there is operator for deleting multi dimensional arrays in the standard C++ language.
If we have created a pointer to a single dimensional arra
Because there is no way to call
int **array = new int[dim1][dim2];
All news/deletes must be balanced, so there's no point to a delete [][]
operator.
new int[dim1][dim2]
returns a pointer to an array of size dim1
of type int[dim2]
. So dim2
must be a compile time constant. This is similar to allocating multi-dimensional arrays on the stack.