fork(1) download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. typedef uint16_t u16;
  5.  
  6. union S {
  7. struct {
  8. u16 a: 9;
  9. u16 b: 1;
  10. u16 c: 1;
  11. u16 d: 1;
  12. } ;
  13.  
  14. struct {
  15. u16 reserved: 12; // Number of bits used in the first struct
  16. u16 e: 4;
  17. };
  18.  
  19. };
  20.  
  21. int main(void) {
  22. printf("%zu\n", sizeof(union S));
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5504KB
stdin
Standard input is empty
stdout
2