fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a = 111;
  6. int& b = a;
  7.  
  8. {
  9. int c = 222;
  10. b = c;
  11. }
  12.  
  13. std::cout << std::boolalpha;
  14. std::cout << a << " " << b << " "
  15. << (a == b) << " " << (&a == &b) << std::endl;
  16.  
  17. int* a1 = &a;
  18. int* b1 = &b;
  19. std::cout << a1 << " " << b1
  20. << " " << (a1 == b1) << std::endl;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
222 222 true true
0x7ffdb6939194 0x7ffdb6939194 true