The operator that releases previously allocated memory is _____ A. release B. return C. delete D. destroy

release
return
delete
destroy

The correct answer is C. delete.

The delete operator releases previously allocated memory. It is used to deallocate dynamically allocated memory. The delete operator takes a pointer to the memory to be deallocated as its operand.

The release operator is used to release memory that has been allocated with the malloc or calloc function. It does not deallocate the memory, but it does make it available for reuse.

The return statement is used to return a value from a function. It does not release any memory.

The destroy operator is used to destroy an object. It is not used to release memory.

Here is an example of how to use the delete operator:

int *p = new int(5);
delete p;

In this example, the pointer

p is allocated with the new operator. The delete operator is then used to deallocate the memory pointed to by p.
Exit mobile version