What is the array form of ‘delete’?

The array form of delete is:

delete [] data;

Edit: But as others have pointed out, you shouldn’t be calling delete for data defined like this:

int data[5];

You should only call it when you allocate the memory using new like this:

int *data = new int[5];

Leave a Comment