Quiz- Win32記憶體表示與數值大小

weixin_34304013發表於2012-08-02

問題

在VS2010的memory視窗中檢視地址為0x00635878記憶體, 如圖.

image

 

如果我一直該地址的記憶體儲存的值是一個指標, 那麼該指標的值是多少?

A. 40b4ca74

B. 47ac4b04

C. 74cab440

D. 044bac47

 

答案

C. 74cab440

 

這裡涉及到了一個little endian的概念.

These two phrases “Big Endian” and “Little Endian” are derived from "Big End In" and "Little End In." They refer to the way in which memory is stored.

On an Intel computer, the little end is stored first. This means a Hex word like 0x1234 is stored in memory as (0x34 0x12). The little end, or lower end, is stored first. The same is true for a four-byte value; for example, 0x12345678 would be stored as (0x78 0x56 0x34 0x12).

"Big End In" does this in the reverse fashion, so 0x1234 would be stored as (0x12 0x34) in memory. This is the method used by Motorola computers and can also be used on RISC-based computers. The RISC-based MIPS computers and the DEC Alpha computers are configurable for Big Endian or Little Endian. Windows NT works only in the Little Endian mode on both computers.

http://support.microsoft.com/kb/102025

相關文章