Arrays | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Arrays are known as a data structure as they can hold more than one value. In order to fully understand arrays it is best to start off with an example.
We could store these in variables as follows :-
This means that by the end we will have 15 separate variables. This is clearly not a good way to store this information. What happens if there was 100 students? We would have 300 variables. By using arrays we can store the above information in just 3 arrays.
This is much more efficient. What we have effectively done is created a one dimensional table (or just a single column) to store our data in. We have assigned a name to the array, given it a size and then placed data within it. We can draw these arrays in diagram form
|