fork download
  1. #include <stdio.h>
  2.  
  3. struct xy {
  4. int x;
  5. int y;};
  6. struct zw {
  7. int z;
  8. struct xy w;};
  9.  
  10. int main(void) {
  11. struct zw a;
  12. struct zw b = {10, {20, 30}};
  13. struct zw c = {40, {50, 60}};
  14. a.z = b.z;
  15. printf("a.z = %d\n", a.z);
  16. a.w.x = b.w.x;
  17. printf("a.w.x = %d\n", a.w.x);
  18. a.w = b.w;
  19. printf("a.w.y = %d\n", a.w.y);
  20.  
  21. a = c;
  22. printf("a.z = %d\n", a.z);
  23. printf("a.w.x = %d\n", a.w.x);
  24. printf("a.w.y = %d\n", a.w.y);
  25. // your code goes here
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5292KB
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