/* A demo program to show dynamic variable */ #include using namespace std; void Pause() { cout <<"Press any key to continue:"; char key; cin >> key; } int main() { int *p=NULL; cout << "Keep on dynamically allocate an int array of size 10000:\n"; while (true) { p = new int[1000000]; //assign the address of variable a to p cout <<"Pointer p=" << p << ", pointing to int with value" << *p << endl; delete [] p; // free the block of memory p = NULL; // important to update p's value } }