c - cannot take address of bit-field
问题 Why cannot take address of bit-field? How do I make a pointer to bit-field? Here is the code... struct bitfield { unsigned int a: 1; unsigned int b: 1; unsigned int c: 1; unsigned int d: 1; }; int main(void) { struct bitfield pipe = { .a = 1, .b = 0, .c = 0, .d = 0 }; printf("%d %d %d %d\n", pipe.a, pipe.b, pipe.c, pipe.d); printf("%p\n", &pipe.a); /* OPPS HERE */ // error: cannot take address of bit-field ... return 0; } 回答1: Bitfields members are (typically) smaller than the granularity