I have these two structures :- 1.
typedef struct bitfield
{
unsigned int a:16;
unsigned int b:17;
union
{
unsigned int c:4;
unsigned int d:32;
};
}bfield;
This structure has anonymous union, when i calculate the size of this structure - it comes out to be 12 bytes (4+4+4). This is fine.
2.
typedef struct bitfield
{
unsigned int a:16;
unsigned int b:17;
union u
{
unsigned int c:4;
unsigned int d:32;
};
}bfield;
But my DevC++ compiler on 32 bit machine prints 8 bytes for this structure's size. I don't understand why it comes out to be 8.