fork download
  1. #include <bits/stdc++.h> /* malloc, calloc, realloc, free */
  2. using namespace std;
  3. int main ()
  4. {
  5. int * buffer1, * buffer2, * buffer3;
  6. buffer1 = (int*) malloc (100*sizeof(int));
  7. *buffer1 = 50;
  8. buffer2 = (int*) calloc (100,sizeof(int));
  9. buffer3 = (int*) realloc (buffer2,500*sizeof(int));
  10. cout<<buffer1<<endl; cout<<*buffer1<<endl;
  11. free (buffer1);
  12. free (buffer3);
  13. cout<<buffer1<<endl;
  14. cout<<*buffer1<<endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
0x2b3e2d450c20
50
0x2b3e2d450c20
753072984