previous | index | next

The delete Operator

The delete operator returns the memory allocated by new to the system's free store.

To return the memory in our dynamic array example:

           delete []v;
C++ will free all the memory allocated for v.

To free the memory allocated by a dynamic struct, for example, a list item as just defined:

           delete lst;
Here the operand must be a pointer to a struct.


previous | index | next