fork download
  1.  
  2. #include <stdio.h>//エラーなし
  3.  
  4. struct xy {
  5. int x;
  6. int y;
  7. };
  8.  
  9. struct zw {
  10. int z;
  11. struct xy w;
  12. };
  13.  
  14. int main(void)
  15. {
  16. struct zw a;
  17. struct zw b = {10, {20, 30}};
  18. struct zw c = {40, {50, 60}};
  19.  
  20. a.z = b.z;
  21. printf("a.z = %d\n", a.z);
  22.  
  23. a.w.x = b.w.x;
  24. printf("a.w.x = %d\n", a.w.x);
  25.  
  26. a.w = b.w;
  27. printf("a.w.y = %d\n", a.w.y);
  28.  
  29. a = c;
  30. printf("a.z = %d\n", a.z);
  31. printf("a.w.x = %d\n", a.w.x);
  32. printf("a.w.y = %d\n", a.w.y);
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
a.z = 10
a.w.x = 20
a.w.y = 30
a.z = 40
a.w.x = 50
a.w.y = 60