Deallocation of Dynamic Memory

Get acquainted with the deallocation of dynamic memory.


The compiler automatically deallocates the static space when it is not used anymore. Since dynamically allocated memory is managed by a programmer, when dynamically allocated space is not required anymore, we must free it.

delete operator

The delete operator allows us to free the dynamically allocated space.


The basic syntax for releasing the memory that the pointer is pointing to is given below:

Get hands-on with 1200+ tech skills courses.