Unsure how the output is gotten! Bit fields

Viewed 64

I have been looking at this code for a while. I know that the output is 50 but am unsure how this occurs.

struct
{ 
    unsigned m : 3;
    unsigned n : 5;
} b;

int main(void)
{ 
    b.m = 2;
    b.n = 6;

    printf("%d", b);
}

Any help someone can offer, I would really appreciate it.

1 Answers
Related