现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是().(union u_type{ int i;char ch;float a;}temp;现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是(). A、266 B、256 C、10 D、1
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/29 02:47:26
![现在windows环境下,执行](/uploads/image/z/13383343-55-3.jpg?t=%E7%8E%B0%E5%9C%A8windows%E7%8E%AF%E5%A2%83%E4%B8%8B%2C%E6%89%A7%E8%A1%8C%22temp.i%3D266%3Bprintf%EF%BC%88%22%25d%22%2Ctemp.ch%EF%BC%89%22%E7%9A%84%E7%BB%93%E6%9E%9C%E6%98%AF%EF%BC%88%EF%BC%89.%28union+u_type%7B+int+i%3Bchar+ch%3Bfloat+a%3B%7Dtemp%3B%E7%8E%B0%E5%9C%A8windows%E7%8E%AF%E5%A2%83%E4%B8%8B%2C%E6%89%A7%E8%A1%8C%22temp.i%3D266%3Bprintf%EF%BC%88%22%25d%22%2Ctemp.ch%EF%BC%89%22%E7%9A%84%E7%BB%93%E6%9E%9C%E6%98%AF%EF%BC%88%EF%BC%89.%E3%80%80A%E3%80%81266%E3%80%80B%E3%80%81256%E3%80%80C%E3%80%8110%E3%80%80D%E3%80%811)
现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是().(union u_type{ int i;char ch;float a;}temp;现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是(). A、266 B、256 C、10 D、1
现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是().(
union u_type
{ int i;
char ch;
float a;
}temp;
现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是(). A、266
B、256
C、10
D、1
现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是().(union u_type{ int i;char ch;float a;}temp;现在windows环境下,执行"temp.i=266;printf("%d",temp.ch)"的结果是(). A、266 B、256 C、10 D、1
这是个共用体,他们所有成员的内存分配都一样
266表示2进制100001010;
他们是从右边开始的(低位)因此temp.ch是一个字节;就是8位
因此对齐,发现最左边的1被丢弃,剩下为00001010;为10;
你该懂吧.
我不出山好久了.