Quantcast
Channel: Active questions tagged syntax-error - Stack Overflow
Viewing all articles
Browse latest Browse all 175

cannot take address of bit-field

$
0
0

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;}

Viewing all articles
Browse latest Browse all 175

Latest Images

Trending Articles



Latest Images