Ch 9 · Arrays · C
Topic 9 of 13 in C — Complete Tutorial (Beginner) — 2 lessons.
Arrays
An array stores many values of the same type together under one name. In C, an array has a fixed size set when you create it, and each item has an index starting from 0. So an array of 5 items has valid indices 0 to 4. C does not check whether your index is valid, so reading or writing outside the array causes bugs — always stay within bounds.
Processing Arrays
The most common task with an array is processing every element — summing, finding the largest, counting. You loop over the items and combine them into a result. Because C arrays do not store their own length, you must track the size yourself (here, 6). The example sums an array, computes the average, and finds the highest value.