delete operator in C++


What is the use of new and delete operator in C++?

new operator is used to dynamically allocate memory on the heap. Memory allocated by new must be deallocated using delete operator. Syntax of new is: p_var = new type name; where p_var is a previously declared pointer of type typename. typename can be any basic data type. new can also create an array: p_var = […]