size of a structure containing bit fields [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Why isn't sizeof for a struct equal to the sum of sizeof of each member? I was trying to understand the concept of bit fields. But I am not able to find why the size of the following structure in CASE III is coming out as 8 bytes. CASE I: struct B { unsigned char c; // +8 bits } b; sizeof(b); // Output: 1 (because unsigned char takes 1 byte on my system) CASE II: struct B { unsigned b: 1; } b; sizeof(b); //