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