fork download
  1. #include <iostream>
  2.  
  3. int* foo() {
  4. static int x;
  5. return &x;
  6. }
  7. int* bar() {
  8. static int y;
  9. return &y;
  10. }
  11.  
  12. int main () {
  13. int *a, *b;
  14. a = foo();
  15. if (a)
  16. b = a;
  17. a = bar();
  18. std::cout << a << " != " << b << "\n";
  19. }
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
0x804a0d8 != 0x804a0dc