fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef union {
  5. int Value;
  6. struct SubStruct1 {
  7. int Value;
  8. } SubStruct1;
  9.  
  10. struct SubStruct2 {
  11. int Value;
  12. } SubStruct2;
  13.  
  14. struct SubStruct3 {
  15. int Value;
  16. } SubStruct3;
  17. } T;
  18.  
  19. void print( T *t )
  20. {
  21. printf("%d\n",t->Value);
  22. }
  23.  
  24. int main()
  25. {
  26. T t;
  27. t.SubStruct1.Value = 1;
  28. print(&t);
  29. t.SubStruct2.Value = 2;
  30. print(&t);
  31. t.SubStruct3.Value = 3;
  32. print(&t);
  33.  
  34. return 0;
  35. }
  36.  
  37.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
1
2
3