fork(18) download
  1. #include <limits.h>
  2. #include <stdio.h>
  3.  
  4. struct OneBit {
  5. unsigned int value:1;
  6. };
  7. typedef struct OneBit onebit;
  8.  
  9. int main(void) {
  10. onebit x;
  11. x.value = 1;
  12. x.value++;
  13. printf("1 incremented is %d\n", x.value);
  14. printf("each object of type 'onebit' needs %d bytes (%d bits)\n",
  15. (int)sizeof x, CHAR_BIT * (int)sizeof x);
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
1 incremented is 0
each object of type 'onebit' needs 4 bytes (32 bits)