Here i am doing dynamic memory allocation .But problem is that after deleting memory, the data is not removing from that block.Only first two blocks are deleting. Why ?
 #include <iostream>
 #include <new>
 using namespace std;
int main ()
{
  int i,n;
  int * p;
  cout << "How many numbers would you like to type? ";
  cin >> i;
  p= new (nothrow) int[i];
  if (p == 0)
    cout << "Error: memory could not be allocated";
  else
  {
    for (n=0; n<i; n++)
    {
      cout << "Enter number: ";
      cin >> p[n];
    }
    cout << "You have entered: ";
    for (n=0; n<i; n++)
      cout <<"Value= "<< p[n] << ",Address = "<<&p[n]<<endl;
    delete p;
    cout<<endl<<"After Deallocation"<<endl;
  for (n=0; n<i; n++)
      cout <<"Value= " <<p[n] << ",Address = "<<&p[n]<<endl;
}
  return 0;
}

 
    