teach-ict.com logo

THE education site for computer science and ICT

1. Introduction to Arrays

An array is a particular type of list data structure - we have a section on lists HERE. An array is used to store related data that are of the same type.

For example, say you wanted to store the names of players in a football team. The team has 11 players.

One way, is to store the names as independent variables,

Like this:

               player1 = "John Smith"

               player2 = "Harry Potter"

               player3 = "Jimmy Carr"
                 ... and so on

So there would be eleven variables. The problem with this is it does not show that there is relationship between the names - that they are all part of the same football team. This is why an array data store is useful - it allows related data item to be stored as a group.

 

image