binary - Little Endian - Memory content/address -


consider system has byte-addressable memory organized in 32-bit words according big-endian scheme. program reads ascii characters entered @ keyboard , stores them in successive byte locations starting @ location 1000.

show contents of 2 memory words @ locations 1000 , 1004 after name johnson has been entered. write in little-endian scheme.

what got was:

[null, n], [o, s], [n,h], [o,j] 00, 6e 6f, 73 6e, 68 6f, 6a

i want know if correct , if not, did wrong.

thank all!

there no such thing endianes storing single byte (such ascii character). endianes comes play when value represented multiple bytes. example, storing sequence of bytes same in little- , big-endian, representation of bytes different. example, take number 3 735 928 559 (or 0xdeadbeef in hex notation) , store 32-bit word (e.g., int) @ memory location 1000 give:

adr: 1000 1001 1002 1004   be:   de   ad     ef   le:   ef     ad   de   

so, if represent ascii character 32-bit word get:

[0, 0, 0, 6a], [0, 0, 0, 6f], ... or,   [6a, 0, 0, 0], [6f, 0, 0, 0], ... 

for , le respectively.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -