i have question related bit-fields in c. here have such structure:
struct register { int bit:1; }; int main(void) { struct register bit = {1}; printf("\nbit = %d", bit.bit); return 0; }
can please explain me why get:
bit = -1
if you're working bitfields, should use unsigned int
. signed int
problem bit-fields.
Comments
Post a Comment