How do you allocate and deallocate memory in c++?
The new operator is used in C++ to allocate memory from the free store (or heap). int *ptr=new int; , and the delete operator to deallocate.