Advertisement Remove all ads

Explain Use of Memory Management Operators in C++. - Computer Science 1

Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Short Note

Explain use of Memory Management Operators in C++.

Advertisement Remove all ads

Solution

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.

Concept: C++ Programming
  Is there an error in this question or solution?

APPEARS IN

Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×