struct name { int a:16; }
It means a
is defined as 16-bit memory space. The remaining bits (16 bits) from int
can be used to defined another variable, say b
, like this:
struct name { int a:16; int b:16; }
So if int
is 32-bit (4 bytes), then the memory of one int
is divided into two variables a
and b
.
PS: I'm assuming sizeof(int)
= 4 bytes, and 1 byte = 8 bits