Explain use of Memory Management Operators in C++.
Use of memory management operator : new and delete
(1) The new operator is used to create objects of any type.
(2) The syntax is as follows:
Pointer_variable = new data type;
(3) Example : p = new int; // p is pointer of type int .
(4) The delete operator is used to destroy the variable from the memory space so that the same space can be used for another use.
(5) The syntax of delete is as follows:
delete pointer variable;
(6) Example: delete p; // delete pointer variable p from memory.