Grade 11 · Practical
Arrays
Structured Programming · about 4 min
An array stores many related values under one name, accessed by an index. Loops process arrays to search, total, count and sort.
Key points- Declare with bounds: `var marks : array[1..30] of integer;` — index 1..30.
- A `for` loop visits every element: `for i := 1 to 30 do total := total + marks[i];`.
- Common algorithms: running total/average, find max/min, linear search with a found-flag, count matches.
- Parallel arrays (names[] and marks[]) store related data at the same index — always process them together.
- Array — an indexed collection of values of the same type.
- Index — the position number used to access an array element.
- Parallel arrays — separate arrays whose matching indices belong together.
EXAM TIP
to find the highest value, assume the first element is the max, then loop from the second comparing and updating.