Hi,
A structure is defined as follows:
Is it assigning value 1,4,4 to bit1,bit3 and bit4,respectively?Code:struct value { int bit1:1; int bit3:4; int bit4:4; }bit={1,2,2};
Hi,
A structure is defined as follows:
Is it assigning value 1,4,4 to bit1,bit3 and bit4,respectively?Code:struct value { int bit1:1; int bit3:4; int bit4:4; }bit={1,2,2};
1,2,2 are the values assigned.
1,4,4 are the number of bits allocated to each variable (look up bit fields).
A signed bit-field with a width of 1 can only store 0 or -1 by the way.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.