2D Arrays
4 × 5 — but memory is one flat line of 20
| c0 | c1 | c2 | c3 | c4 | |
|---|---|---|---|---|---|
| r0 | 0 | 1 | 2 | 3 | 4 |
| r1 | 5 | 6 | 7 | 8 | 9 |
| r2 | 10 | 11 | 12 | 13 | 14 |
| r3 | 15 | 16 | 17 | 18 | 19 |
A 2D array looks like a grid. It isn't. Memory is one long line — the grid is a fiction, and the computer keeps it up with a single piece of arithmetic.
step 01/23
- comparing
- in final place