Share via


delete Operator

C++ Specific

[::] deletepointer

[::] **delete[ ]**pointer

The delete keyword deallocates a block of memory. The argument pointer must point to a block of memory previously allocated by the new operator. If pointer points to an array, place empty brackets before pointer.

Example

In the following example, the block of memory pointed to by pFile is deallocated:

// Example of the delete operator
CATCH_ALL(e)
   {
      ar.Close();
      delete pFile;
      THROW_LAST();
   }
   END_CATCH_ALL

END C++ Specific