How are ASCII characters stored in memory?

Consider a computer with byte address memory, organized in 32-bit words according to the large-end scheme. The program reads the ASCII characters entered from the keyboard and saves them in sequential byte locations starting at location 1000. Show the contents of the two memory words at locations 1000 and 1004 after entering the name "johnson".

+3
source share
3 answers

Simply convert each letter to hex using a convenient ASCII table and add them to memory one by one. It easily looks like great ASCII graphics:

+------+--+--+--+--+
|0x1000|6A|6F|68|6E|
+------+--+--+--+--+

, .

+3

, endianes (, ASCII). Endianes , . , , , . , 3 735 928 559 ( 0xdeadbeef ) 32- (, int) 1000:

: 1000 1001 1002 1004
BE: de ad be ef
LE: ef be ad de

0

, :

1000: 0x6a6f686e
1004: 0x736f6e00

' 7 , , (00) .

-2
source

Source: https://habr.com/ru/post/1719969/


All Articles