Some useful examples to help with your studies

Array Example

After the session on multi-dimensional arrays, I thought it best to take a look at them again.

To get your head around them it is perhaps best to think of an array as similar to a table storing data.

In the following example, I will use a selection of books for an online store. Each book will have a set of meta data which will be need to be stored in the array (or table)

Each book will be stored in a row of the array, and the 4 pieces of data will be stored stored within the row in different coloums as in the table below:

Books
Row 0 The Girl with the Dragon Tattoo Stieg Larsson 7.99 1847245458
Row 1 Silence of the Lambs Thomas Harris 6.99 0099297701
Row 2 Harry Potter and the Philosopher's Stone J K Rowling 6.99 0747542988
Row 3 Smiley's People John le Carre 1.95 0330262726
Row 4 The Business Iain Banks 6.99 0349112452
Row 5 The Hitch-Hikers Guide to the Galaxy Douglas Adams 2.99 0330258648

 

Please take note:

These pages are for demonstration only. They may be incomplete and/or contain errors as their purpose is to help with the course.

They may also be modified at any point and will probably only be available for a short period