Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(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;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict