fork download
  1. #include <iostream>
  2.  
  3. struct A {
  4. int i = 10;
  5. };
  6.  
  7. struct B {
  8. A arr[3];
  9. };
  10.  
  11. struct C {
  12. A arr[3];
  13. A& ref = arr[0];
  14. };
  15.  
  16. struct D {
  17. A arr[3];
  18. A& ref = arr[0];
  19. A& ref2 = arr[0];
  20. };
  21.  
  22.  
  23. int main() {
  24. int s1 = sizeof(B) + 100;
  25. std::cout << s1 << std::endl;
  26. int s2 = sizeof(C) + 100;
  27. std::cout << s2 << std::endl;
  28. int s3 = sizeof(D) + 100;
  29. std::cout << s3 << std::endl;
  30.  
  31. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
112
116
120