Record structures (Cambridge International AS Computer Science)
Exam board Cambridge International · ASUpdated 2025-04-30
Purpose of records
What is a record?
-
A record is a composite data structure used to store a collection of related data items
-
Each item can be of a different data type
-
It allows a programmer to group related values under one identifier
-
Records help create a more structured and readable approach to storing and managing data
-
A record contains a fixed number of fields, each with its own name and type
-
In pseudocode, a record can by declared as:
-
Suppose we want to store information about a car
-
We can define a record type like this:
-
We can then create a variable of this type:
-
And assign values to its fields:
-
To read from the record we can:
Exam Hint
- Records in programming are a type of data structure used to group related data in your code
- These are not the same as records in a database, which refer to a complete set of fields on a single entity in a table (row)
Key features of records
| Feature | Explanation |
|---|---|
| Can store different data types | Unlike arrays, records are not limited to a single type |
| Fields are named | Each item in the record has a meaningful identifier |
| Offers structured storage | Easier to manage complex data about real-world entities |
Was this revision note helpful?
Build on this topic