fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int value = 10;
  6. struct A {
  7. int f() { return value; }
  8. };
  9. A a;
  10. cout << a.f() << endl;
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘int main()::A::f()’:
prog.cpp:7:20: error: use of local variable with automatic storage from containing function
   int f() { return value; }
                    ^~~~~
prog.cpp:5:6: note: ‘int value’ declared here
  int value = 10;
      ^~~~~
stdout
Standard output is empty