bit域不可用&来取得地址
typedef struct BitTest
{
unsigned a;
unsigned c:3;
unsigned b;
}BT;
{
unsigned a;
unsigned c:3;
unsigned b;
}BT;
声明BT的变量bt
不能出现&bt.c 但是可以用&bt.a或者&bt.b
typedef struct BitTest
{
unsigned a:1;
unsigned :3;
unsigned b:3;
}BT;
{
unsigned a:1;
unsigned :3;
unsigned b:3;
}BT;
对于这个BT来说,sizeof(BT)=4;
但是对于
typedef struct BitTest
{
unsigned a:1;
unsigned :0;
unsigned b:3;
}BT;
{
unsigned a:1;
unsigned :0;
unsigned b:3;
}BT;
来说,sizeof(BT)=8, 其中unsigned :0用来填出a开辟的空间中没有使用的哪些部分,而b重新再开辟自己的空间