fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int* func()
  6. {
  7. int arr[1];
  8. arr[0] = 100;
  9. return &arr[0];
  10. }
  11.  
  12. int main()
  13. {
  14. int* p = func();
  15.  
  16. printf("%i", *p);
  17. char* x = (char*)malloc(sizeof(char) * 5);
  18. printf("%i", *p);
  19.  
  20. free(x);
  21.  
  22.  
  23. return 0;
  24. }
Runtime error #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty