(C++) [delete\[\]](CppDeleteArray.md)

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) delete[]

 

delete[] (pronounced as 'delete array') is the version of delete to delete arrays. In the example below, calling delete would only delete the first element of the arrays, where delete[] really deletes the arrays.

 


int main() {   const int sz = 3;   int * const array = new int[sz];   //Do stuff with array   delete[] array; }