fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. typedef struct {
  5. uint16_t statusCode : 4;
  6. unsigned errorCode : 4;
  7. unsigned outputEnabled : 1;
  8. unsigned currentClip : 1;
  9. unsigned : 6;
  10. } SupplyStruct_t;
  11.  
  12. typedef struct {
  13. uint16_t statusCode : 4;
  14. uint16_t errorCode : 4;
  15. uint16_t outputEnabled : 1;
  16. uint16_t currentClip : 1;
  17. uint16_t : 6;
  18. } SupplyStruct_t1;
  19.  
  20.  
  21. typedef union {
  22. SupplyStruct_t s;
  23. uint16_t value;
  24. } SupplyStatus_t;
  25.  
  26. typedef union {
  27. SupplyStruct_t1 s;
  28. uint16_t value;
  29. } SupplyStatus_t1;
  30.  
  31. int main(void) {
  32. printf("%zu %zu\n", sizeof(SupplyStatus_t), sizeof(SupplyStatus_t1));
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 4316KB
stdin
Standard input is empty
stdout
4 2