编程题:引用共用体变量的成员
#include<stdio.h>
void main()
{ union temp
{char a;
int b;
}t;
t.a=66;t.b=266;
/*266=256+10即266的二进制为100001010,所以高字节放低字节放10*/
printf("%x:%d,%x:%d\n",&t.a,t.a,&t.b,t.b);
}
分析代码的算法:
运行结果:
转载于:https://blog.51cto.com/c10086/1413761