Imagine you need to store the test scores of 5 students. You create five separate variables — score1, score2, score3, score4, score5 — but that's clunky, and it falls apart completely if you have 500 students instead of 5. You'd need 500 variable names, and looping through them would be impossible because you can't easily say "give me variable number 347" in a loop.
An array solves this. Think of it like a strip of numbered pigeonholes bolted to a wall. The whole strip has one name (say, scores), and each pigeonhole has a position number. To get a value out, you don't need a new variable name — you just say "give me the value in pigeonhole 3."
Formally, an array is defined by three properties, and all three matter for exam answers:
Definition to memorise word-for-word
An array is an ordered, static (fixed-size) set of elements stored in a single, named block of memory, where every element must be the same data type.
- Ordered — every element has a fixed position (an index), so the array always keeps the same sequence unless you explicitly change it.
- Static / fixed-size — once you declare an array to hold, say, 5 elements, it always has exactly 5 slots. You can't stretch it to hold a 6th value without creating a new array. (This is different from a Python , which can grow — but for IGCSE purposes, arrays are treated as fixed-size.)
- Single data type — an array of integers can only hold integers. You can't mix a string into an array of numbers.
Visualising a 1D array
Here's the array ["B","E","A","D","S"] drawn out — notice this uses zero-indexing (the Python/most-languages convention):
Array length is 5 · First element is at index 0 · The 4th element ("D") sits at index 3
The single most important rule in this whole chapter
In CIE pseudocode, indexes start at 1. In Python, indexes start at 0. This is the #1 thing that trips students up in exams — because you'll be shown pseudocode and Python for the exact same array, and the same real-world position (e.g. "the 4th element") will be written as [4] in pseudocode but [3] in Python.
Practice Question 1
An array called fruits stores 6 values. In CIE pseudocode, what index would you use to access the very last element? What about in Python?
Practice Question 2