fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int* a=new int[10];
  7. for (int i=0; i<10;i++)
  8. a[i]=i+1;
  9. cout<<"Before Deallocation"<<endl;
  10.  
  11. for (int i=0; i<10;i++)
  12. cout<<a[i]<<endl;
  13.  
  14. delete [] a;
  15.  
  16. cout<<"After Deallocation"<<endl;
  17.  
  18. for (int i=0; i<10;i++)
  19. cout<<a[i]<<endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Before Deallocation
1
2
3
4
5
6
7
8
9
10
After Deallocation
0
0
644259856
21972
5
6
7
8
9
10