ProAnswers.org

What are bit fields? What is the use of bit fields in a Structure declaration?

A bit field is a set of adjacent bits within a single implementation based storage unit that we

will call a “word”.

The syntax of field definition and access is based on structure.

Struct {

unsigned int k :1;

unsigned int l :1;

unsigned int m :1;

}flags;

the number following the colon represents the field width in bits.Flag is a variable that contains three bit fields.