Dynamic memory

C++ provides facilities for manual memory management, which gives power to the programmer at the expense of increased responsibility. Dynamic memory is allocated in the heap and is managed with operators like new and delete.


  int* p = new int(5);
  delete p;
  

Beginner's Guide to C++