Use New & Delete Keywords in C++


#include <iostream.h>
#include <conio.h>

int main()
{
      clrscr();

      int *p;
     
      p = new int; // allocate space for an int
     
      *p = 100;
     
      cout << "At " << p << " ";
     
      cout <<     "is the value " << *p << "\n";
     
      delete p;
     
      getch();
     
      return 0;
}
Custom Search