位域结构体的问题
#include<stdio.h>#include<stdlib.h>
struct bitf
{
unsigned bit_0:1;
unsigned dummy:14;
unsigned bit_15:1;
}*bit_buff;
void main()
{
unsigned short x;char buf[20];
for(;;)
{
printf("请输入一个整型数字(若想退出请输入0)");
gets(buf);
if(buf[0]=='0') break;
x=(unsigned short)atoi(buf);
bit_buff=(struct bitf*)&x;
printf("该数的十六进制是:%0x\n",x);
printf("该数在本机内表示的最高位是MBS:%d\n",bit_buff->bit_15);
printf("\n");
}
}
bit_buff=(struct bitf*)&x;
printf("该数在本机内表示的最高位是MBS:%d\n",bit_buff->bit_15);
printf("该数在本机内表示的最低位是LBS:%d",bit_buff->bit_0);
这三步搞不懂 请大家帮忙解释下