Writing a value into a 2D array element
Stores a value in one element of a 2D array. Give the row index first, then the column index, e.g. NoughtsAndCrosses[2,3] ← 'X' puts a CHAR in row 2, column 3.
Understanding Writing a value into a 2D array element in IGCSE Computer Science Paper 2
What it does: The row index 1 comes first, the column index 1 comes second, and the CHAR 'O' is in single quotes. Swapping the indexes reaches a different element. [1,3] is row 1, column 3 and [3,1] is row 3, column 1, so these are two separate elements. The centre of a 3 x 3 grid is row 2, column 2. Grid[3,3] is the bottom right corner. In IGCSE pseudocode, both indexes go inside one pair of brackets, separated by a comma: Board[2,3]. Each dimension needs its own index, so the fix is NoughtsAndCrosses[2,3] ← 'X'.
Common mistakes: A CHAR value must be written in single quotes. Double quotes make it a STRING. Line 1 should be Board[1,1] ← 'X'. The row index comes first and the column index second. Row 2, column 3 is [2,3], not [3,2], which is a different element.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 469–478) and word search (Modules 459–478).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
Name[row, column] ← valueFill in the Blanks
Spot the Error
Student with a class code? Join your class →