fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A
  5. {
  6. int& a;
  7. };
  8.  
  9. int main() {
  10. int a = 5;
  11. cout << (void*)&a << ' ';
  12. A* b = nullptr;
  13. {
  14.  
  15. int& c = a;
  16. cout << (void*)&c << ' ';
  17. b = new A{ c };
  18. }
  19. cout << (void*)&(b->a) << ' ';
  20.  
  21. // your code goes here
  22. return 0;
  23. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
0xbf92b23c 0xbf92b23c 0xbf92b23c