Caffeinated Coder
Book an appointment
Lesson 09 · Memory

Arrays and std::array

An array is a fixed number of values of one type, stored side by side in one block of memory. Follow int a[4] = {3, 1, 4, 1}; into memory, see why a[i] is found by simple arithmetic (start + i × 4 bytes), change one element, add them all up with a loop, and see what happens past the end. Then meet std::array, the same row of values that knows its size and can check an index for you.

11 min9 steps5 questionsIntermediate
Fig 9 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.