假设我有一个由 2 个 UInt8(高位和低位)组成的 UInt16
这个说法正确吗?
As long as the value of the UInt16 is less than 256, all of the memory will exist in the lower bits and the upper bits will be 0
最佳答案
当值被视为 16 位单元时,所有设置的位都将位于低字节中,但是如果将变量的地址转换为 char *,您可能会发现“低字节”位于内存中的“高字节”。
这称为小端存储,例如在基于 Intel x86 的处理器上就是如此。
关于c - 整数的内存分配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47658761/