c/language/bit field

Declares a member with explicit width, in bits. Adjacent bit-field members may be packed to share and straddle the individual bytes.

A bit-field declaration is a or  member declaration which uses the following :

Explanation
Bit-fields can have only one of –  types (possibly  or  qualified):
 * , for unsigned bit-fields ( has the range )
 * , for signed bit-fields ( has the range )
 * , for bit-fields with implementation-defined signedness (Note that this differs from the meaning of the keyword everywhere else, where it means "signed int"). For example,  may have the range of values  or.

Additional implementation-defined types may be acceptable. The number of bits in a bit-field sets the limit to the range of values it can hold:

Multiple adjacent bit-fields are permitted to be (and usually are) packed together:

The special unnamed bit-field of zero breaks up padding: it specifies that the next bit-field begins at the beginning of the next allocation unit:

Because bit-fields do not necessarily begin at the beginning of a byte, address of a bit-field cannot be taken. Pointers to bit-fields are not possible. Bit-fields cannot be used with.