Game Development Reference
In-Depth Information
Figure 14.3
A list of common data types.
Understanding Arrays
Arrays are a way of storing and retrieving large amounts of data in an organized
format. They are very efficient for storing data for many reasons. They can store
both numbers and text.
It
s best to think of arrays as sets of boxes on the floor all connected, or as a
number of bookshelves where you can store your items (data). Each slot can
store particular information that you can quickly retrieve at a later stage.
'
Figures 14.4, 14.5, and 14.6 show several conceptual views of arrays.
Figure 14.4
A conceptual image of a single dimension array.
In C#, you have to declare the structure of the array before you can use it. To do
this, you do the following:
int[] salary = new int [5];
Search WWH ::




Custom Search