You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers arrays and records — two fundamental static data structures used extensively in A-Level Computer Science. Arrays store collections of elements of the same type, while records group related data of different types.
An array is a static data structure that stores a fixed number of elements of the same data type in contiguous memory locations. Each element is accessed using an index (a numerical position).
| Property | Description |
|---|---|
| Fixed size | The size is set when the array is created and cannot change. |
| Homogeneous | All elements must be of the same data type. |
| Contiguous memory | Elements are stored next to each other in memory. |
| Indexed access | Any element can be accessed directly using its index in O(1) time. |
| Zero-based indexing | In most languages, the first element is at index 0. |
DECLARE names: ARRAY[0..4] OF STRING
names[0] = "Alice"
names[1] = "Bob"
names[2] = "Charlie"
// Traverse the array
FOR i = 0 TO 4
OUTPUT names[i]
NEXT i
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.