-
C has a simple memory model. Blocks of memory are
organized as a sequence of bytes which can be manipulated
individually or in contiguous groups.
-
Each byte of memory has an address.
An addresses is stored in a pointer.
-
Each datatype requires one or more bytes to store it.
Typically a character requires one byte, an integer requires
2 or 4 bytes, a double usually take 8 bytes, and so on. It
follows that not every byte address is a legitimate address
of a data object.
Consider how we exchange two values in memory. For the
quantities a and b, we would simply write
float a, b;
float t;
|
|