fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct sysop
  5. {
  6. char name[26];
  7. char quote[64];
  8. int used;
  9. };
  10.  
  11. const sysop & use(sysop & sysopref)
  12. {
  13. sysopref.used++;
  14. return sysopref;
  15. }
  16.  
  17. int main()
  18. {
  19. sysop s;
  20. s.used = 0;
  21.  
  22. const sysop& ret_ref = use(s);
  23.  
  24. std::cout<<s.used<<std::endl;
  25. std::cout<<ret_ref.used<<std::endl<<std::endl;
  26.  
  27. std::cout<<&(s)<<std::endl;
  28. std::cout<<&(ret_ref)<<std::endl;
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
1
1

0xbfc910f0
0xbfc910f0