next up previous contents
Next: Reprentation of Signed Integers Up: Memory Previous: Characters in Memory   Contents

The Memory Model

When programming, we think of the main memory as a long sequence of bytes. Bytes are numbered sequentially; each byte is designated by its number, called the address.

For example, suppose we have a main memory of 4 Gb; there are bytes in the memory; addresses ranging from can be represented using 32 bits (binary digits), or (equiv.) by 8 hexa digits.

Suppose we want to store the string ``john''. With one character per byte, we need 4 successive memory locations (bytes) for the string. Each memory location has an address and a content.

25<25 SetFigFontpt@pt xxxxxxsplain


When we declare a variable, the corresponding number of bytes is reserved in the memory; the name of the variable is just an alias for the address of the first byte in the storage.



Adrian Sandu 2001-08-26