C语言结构体中位域(位段)的使用
#include <stdio.h>
#include <stdlib.h>
struct bit
{
char i1:1;
char i2:1;
char i3:1;
char i4:1;
char i5:1;
char i6:1;
char i7:1;
char i8:1;
};
int main()
{
char x=1;
struct bit *pb=(struct bit*)&x;
pb->i5=1;
printf("%d\n",x);
system("pause");
return 0;
}
摘自:宋金时的blog
补充:软件开发 , C语言 ,