Concepts of Data Structures and Arrays (AQA GCSE Computer Science): Revision Notes
Data structures - Concepts of data structures and arrays
What are data structures and arrays?
A data structure is like a filing system for your computer programmes. Just as you might organise your school papers in different folders, programmers need ways to organise and store multiple pieces of information together.
An array is one of the most important types of data structure. Think of it as a row of numbered boxes where you can store different pieces of data. Instead of creating separate variables for each piece of information (like student1, student2, student3), you can store all related data together under one name.
Arrays are incredibly useful in real-world programming. For example, in a computer game, you might need to store the names of multiple players, or the scores from different levels. Rather than creating dozens of separate variables, you can use an array to keep everything organised under one identifier.
Understanding 1-dimensional arrays
A 1-dimensional array (or 1D array) is the simplest type of array. Picture it as a single row of storage compartments, each with its own address number.
Index values - the key to finding your data
Every item in an array has an index value. This is simply a number that tells you exactly where to find that piece of data.
Arrays always start counting from 0, not 1! This might feel strange at first, but it's how all programming languages work. This is the most common mistake students make when learning arrays.

In this example, you can see how the array stores four student names. Notice that 'Fletcher' is at index 0, 'Imogen' is at index 1, and so on.
Creating and working with arrays
When you create an array, you need to understand two important characteristics:
- Arrays have a fixed number of items that's decided when you create them
- Every item in the array must be the same data type (all numbers, or all text, but not mixed)
Let's look at a practical example with numbers:

This array contains 8 numbers, with indices running from 0 to 7. If you wanted to access the value 10, you'd use index 3.
Using FOR loops with arrays
Arrays become really powerful when you combine them with FOR loops. This allows you to process every item in the array automatically, without having to write separate code for each element.
Worked Example: Adding up array values
Here's how you might add up all the numbers in an array:
total ← 0
FOR i ← 0 TO 7
total ← total + scores[i]
ENDFOR
OUTPUT total
This code would give you a total of 43 by adding: 5+7+0+10+8+3+7+3.
Programming examples in different languages
Different programming languages have their own ways of working with arrays, but the core concepts remain the same.
Python uses something called lists instead of traditional arrays. Lists are actually more flexible - they can contain different data types and can change size while your programme runs:
scores = [5,7,0,10,8,3,7,3]
total = 0
for x in range(8):
total = total + scores[x]
print(total)
VB.Net uses this syntax:
Dim scores As Integer() = {5,7,0,10,8,3,7,3}
Dim total As Integer = 0
For x = 0 To 7
total = total + scores(x)
Next x
Console.WriteLine(total)
C# looks like this:
int[] scores = new int[] {5,7,0,10,8,3,7,3};
int total = 0;
for (int x = 0; x < 8; x++)
{
total = total + scores[x];
}
Console.WriteLine(total);
FOR EACH loops - an easier way
Many programming languages offer FOR EACH loops, which make working with arrays even simpler. Instead of worrying about index numbers, you can process each item directly:
Python:
scores = [5,7,0,10,8,3,7,3]
total = 0
for item in scores:
total = total + item
print(total)
Understanding 2-dimensional arrays
A 2-dimensional array (or 2D array) is like a table or spreadsheet with rows and columns. Instead of just one row of data, you have multiple rows stacked on top of each other.

This 2D array shows game scores arranged in a table format. To access any specific value, you need two index numbers - one for the row and one for the column. For example, to get the value 99, you'd use scores[1][1].
Accessing 2D array elements
To work with every element in a 2D array, you need nested loops - that's one loop inside another loop:
A nested loop is one loop that sits within another loop. The inner loop completes all its iterations for each single iteration of the outer loop.
Worked Example: Accessing all 2D array elements
FOR x ← 0 TO 2
FOR y ← 0 TO 3
OUTPUT scores[x][y]
ENDFOR
ENDFOR
This code visits every single element in the array, starting with [0][0], then [0][1], [0][2], and so on.
2D arrays in different programming languages
Python handles 2D arrays using lists within lists:
for x in range(3):
for y in range(4):
print(scores[x][y])
VB.Net uses this approach:
For x = 0 To 2
For y = 0 To 3
Console.WriteLine(scores(x,y))
Next y
Next x
C# syntax looks like:
for (int x = 0; x < 3; x++)
{
for (int y = 0; y < 4; y++)
{
Console.WriteLine(scores[x,y]);
}
}
Exam tips and common mistakes
Common Pitfalls to Avoid:
- Remember the zero! Arrays start at index 0, not 1. This is the most common mistake students make.
- Count carefully - if an array has 10 elements, the indices go from 0 to 9, not 1 to 10.
- Understand the difference between the array's size and its highest index (size is always one more than the highest index).
Study Tips:
- Practice nested loops for 2D arrays - draw out the table structure if it helps you visualise the problem.
- Know your syntax - different programming languages use different brackets: Python uses
[x][y], while C# might use[x,y].
Key Points to Remember:
- Arrays are data structures that store multiple related items under one name
- Index values start at 0 and tell you exactly where to find each piece of data
- 1D arrays need one index number, 2D arrays need two index numbers (row and column)
- FOR loops are essential tools for processing array elements efficiently
- Different programming languages have different syntax, but the core concepts of arrays remain the same