This answer is restricted. Please login to view the answer of this question.Login Now
The new operator denotes a request for memory allocation on the Free Store. If sufficient memory is available, new operator initializes the memory and returns the address of the newly allocated and initialized memory to the pointer variable.
pointer-variable = new data-type;
Once we no longer need to use a variable that we have declared dynamically, we can deallocate the memory occupied by the variable.
For this, the
delete operator is used. It returns the memory to the operating system. This is known as memory deallocation.
Advantage of new over malloc are
Click here to submit your answer.