你能解释一下为什么这段代码的输出是 12 (1100b)
以及 sizeof(bit1) 是 4byte 的?
#include <stdio.h>
#include <stdlib.h>
struct bitfield
{
unsigned a:5;
unsigned c:5;
unsigned b:6;
};
void main()
{
char *p;
struct bitfield bit1={1,3,3}; //a=00001 ,c=00011 ,b=000011
p=&bit1; // p get the address of bit1
p++; // incriment the address of p in 1
printf("%d\n",*p);
printf("%d\n",sizeof(bit1));
}