You can use delete[] to free the array. This is the only way you can tell the program to look for information about the array and be able to free the entire array.
With plain delete compiler might think that you want to free only one pointer, and that is not the case. Additional information about the size of the array and what additional memory will not look for will not be freed.
The fact that you set char inside the array to \0 does not matter; when you release the array, only the known size of the array is considered. Otherwise, nothing like
Class *array = new Class[50]; array[0] = NULL; delete[] array;
just a memory leak.
source share