April 2011
Beginner
464 pages
9h 18m
English
An array is a collection of related data that all have the same data type. An array can be envisioned as a series of data storage locations. Each storage location is called an element of the array.
An array is declared by writing the data type and the array name followed by the number of elements the array holds inside square brace. Here’s an example:
long peaks[25];
The peaks array holds 25 long integers. This declaration causes the compiler to sets aside enough memory to hold all 25 elements. Because each long ...