#include
#include
#include
union
{
int index;
struct
{
unsigned int x : 1;
unsigned int y : 1;
unsigned int z : 2;
} bits;
} number;
int main()
{
for (number.index = 0; number.index < 20; number.index++)
{
printf("index = %d, bits = %d %d %d\n", number.index,number.bits.z, number.bits.y, number.bits.x);
}
return 0;
}
to SIDHARTH SIR…
i am getting the output but not able to understand it
and union causes the bits to be stored in the same memory location..??is it true