fork download
  1. #include <stdio.h>
  2.  
  3. struct A
  4. {
  5. int i;
  6. char c;
  7. };
  8.  
  9. int main()
  10. {
  11. union {
  12. struct A a;
  13. int i[2];
  14. } u;
  15.  
  16. memset(&u.a, 0, sizeof u.a);
  17. printf("%d\n", u.i[1]);
  18.  
  19. u.a.c = 1000;
  20. printf("%d\n", u.i[1]);
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 1788KB
stdin
Standard input is empty
stdout
0
232