为什么在下面的示例中字节地址仅存储2位数字?

问题描述 投票:0回答:2
int x = 0x76543210;
char *c = (char*) &x;

Big endian format:
------------------
Byte address  | 0x01 | 0x02 | 0x03 | 0x04 | 
              +++++++++++++++++++++++++++++
Byte content  | 0x76 | 0x54 | 0x32 | 0x10 |

为什么字节地址ox01仅存储0x76而不存储0x765?

c pointers memory endianness
2个回答
0
投票

一个字节是8位,以十六进制表示,从0x00-> 0xFF(0-> 255)开始。

0x765-十六进制-可能无法容纳8位。


0
投票

因为在您的计算机体系结构上,char*大小为32位。

© www.soinside.com 2019 - 2024. All rights reserved.