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