array
Differences
This shows you the differences between two versions of the page.
| array [June 11, 2026 at 09:42] – created - external edit 127.0.0.1 | array [June 11, 2026 at 09:57] (current) – Ivan Janevski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| # Array | # Array | ||
| - | An **array** is a fixed-size sequence of elements of the same type stored in contiguous memory. The index of an element determines its address: `base + index * sizeof(element)`. This means any element is reachable in O(1) time without traversal, and the memory layout is cache-friendly — iterating over an array touches sequential cache lines rather than chasing pointers. | + | An **array** is a fixed-size sequence of elements of the same type stored in contiguous memory. |
| + | |||
| + | The index of an element determines its address: `base + index * sizeof(element)`. This means any element is reachable in O(1) time without traversal, and the memory layout is cache-friendly — iterating over an array touches sequential cache lines rather than chasing pointers. | ||
| ```c | ```c | ||
array.txt · Last modified: by Ivan Janevski
