fork download
  1. struct {
  2. unsigned lo : 1;
  3. unsigned mid : 15;
  4. unsigned hi : 1;
  5. unsigned mid2 : 15;
  6. } foo = {0x1, 0x8, 0x1};
  7.  
  8. int main()
  9. {
  10. unsigned int sizeofbitfield;
  11. sizeofbitfield = sizeof(foo);
  12. printf("size of bit fields : %d " , sizeofbitfield);
  13. return 0;
  14. }
Success #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout
size of bit fields : 4