Hello everyone,
BitFields gives us the liberty to decide how many bits to allot for the particular field.
ex.
Code:
struct x
{
   unsigned a:1;
   unsigned b:2;
   unsigned c:3;
};
struct x x1;
x1.a=0; //binary is 0
x1.b=2; // binary is 10
x1.c=5; // binary is 101
so we used only 6 bits.
this means we could accommodate this struct within the size of a char(with char occupying 1 byte i.e 8 bits)

so does this get stored as 010101 in contiguous memory locations ?
if so then
my question here is can we typecast this structure to char and print it with %c or %d as a whole value? i.e decimal of 010101 is 21 and its ASCII equivalent using %c ????

Regards.