关于位域运算 麻烦帮解释下下列程序#includevoid main(){struct bs{unsigned a:1;unsigned b:3;unsigned c:4;} bit,*pbit;bit.a=1;bit.b=7;bit.c=15;printf("%d,%d,%d\n",bit.a,bit.b,bit.c);pbit=&bit;pbit->a=0; //此后三行是什么意思pbit->

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 19:36:32
关于位域运算 麻烦帮解释下下列程序#includevoid main(){struct bs{unsigned a:1;unsigned b:3;unsigned c:4;} bit,*pbit;bit.a=1;bit.b=7;bit.c=15;printf(a=0; //此后三行是什么意思pbit->" />
x]oPǿɌL60(v7=ej /ް%8{AEe.%|{-<}ZxגϏ&/ÆqMz={ܲ:h2YD?߿lnz>DX52l^Q!AEY,slA#+@Y 1~@J5Z~o+JīYYߏ,\0ShJrvriQ`yw0nv?C3+Mtp6ׇ G8f3&YAb j~ CyHqH_֦;[Nլ]j ]C1D!,,qݐ @*#1O N

关于位域运算 麻烦帮解释下下列程序#includevoid main(){struct bs{unsigned a:1;unsigned b:3;unsigned c:4;} bit,*pbit;bit.a=1;bit.b=7;bit.c=15;printf("%d,%d,%d\n",bit.a,bit.b,bit.c);pbit=&bit;pbit->a=0; //此后三行是什么意思pbit->
关于位域运算 麻烦帮解释下下列程序
#include
void main()
{
struct bs
{
unsigned a:1;
unsigned b:3;
unsigned c:4;
} bit,*pbit;
bit.a=1;
bit.b=7;
bit.c=15;
printf("%d,%d,%d\n",bit.a,bit.b,bit.c);
pbit=&bit;
pbit->a=0; //此后三行是什么意思
pbit->b&=3;
pbit->c|=1;
printf("%d,%d,%d\n",pbit->a,pbit->b,pbit->c);
}
还有这个程序
#include
void main(){
char a='a',b='b';
int p,c,d;
p=a;
p=(p8;
printf("a=%d\nb=%d\nc=%d\nd=%d\n",a,b,c,d);
}
我不知道为什么c的输出值为97?

关于位域运算 麻烦帮解释下下列程序#includevoid main(){struct bs{unsigned a:1;unsigned b:3;unsigned c:4;} bit,*pbit;bit.a=1;bit.b=7;bit.c=15;printf("%d,%d,%d\n",bit.a,bit.b,bit.c);pbit=&bit;pbit->a=0; //此后三行是什么意思pbit->
pbit结构bs的指针,指向bit首地址,pbit->a相当于bit.a
这三句分别是将0值赋给bit.a、将bit.b的值与3按位与、将bit.c的值与1按位或
00000111 & 00000011 = 00000011 = 3
00000100 | 00000001 = 00000101 = 5
a、b字符存储ASCII码,相当于整型的97和98,二进制分别为1100001和1100010
p