fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. struct {
  6. unsigned char bit1 :1;
  7. unsigned char bit2 :1;
  8. unsigned char bit3 :1;
  9. unsigned char bit4 :1;
  10. unsigned char bit5 :1;
  11. unsigned char bit6 :1;
  12. unsigned char bit7 :1;
  13. unsigned char bit8 :1;
  14. } a;
  15. struct {
  16. unsigned int bit1 :1;
  17. unsigned int bit2 :1;
  18. unsigned int bit3 :1;
  19. unsigned int bit4 :1;
  20. unsigned int bit5 :1;
  21. unsigned int bit6 :1;
  22. unsigned int bit7 :1;
  23. unsigned int bit8 :1;
  24. } b;
  25.  
  26. printf("%u\n", sizeof a);
  27. printf("%u\n", sizeof b);
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.02s 1676KB
stdin
Standard input is empty
stdout
1
4