By Michell Cronberg - for use in training and
presentations
Imaging you have a program with three variables. An 8 bit signed (only positive numbers) integer named a, an 16 bit signed integer named b, and a 32 bit signed integer named c. Given a simple 8-bit memory the compiler/runtime has placed the variables in RAM as follows:
| Name | Bytes | From address | To address |
|---|---|---|---|
| a | 1 | 00000000 (0) | 00000000 (0) |
| b | 2 | 00000001 (1) | 00000010 (2) |
| c | 4 | 00000011 (3) | 00000110 (6) |
| Address | Value |
|---|---|
| 00000000 | 00000000 |
| 00000001 | 00000000 |
| 00000010 | 00000000 |
| 00000011 | 00000000 |
| 00000100 | 00000000 |
| 00000101 | 00000000 |
| 00000110 | 00000000 |
(c) Michell Cronberg 2019 - MIT license