Data items which can be combined to form an individual word of memory are known as bitfields.
Syntax:
struct struct_name
{
member 1 : size;
member 2 : size;
.
.
member n : size;
};
In the above syntax, each member is followed by a semicolon and an unsigned integer which indicates the field size.
The definition and accessing of every member is the same as the ordinary structure.
Example:
We want to store the details of a student. The information can be:
i) Roll no of a student where 1 bits is sufficient.
ii) Standard or class that it belongs to so 3 bits would be sufficient.