Arrays

An array holds a series of data elements of the type (numeric, boolean, string). Individual elements are accessed by their position in the array using an index parameter enclosed in square brackets [ i ]. Array indexes consist of a consecutive range of integers (starting at 0 through the maximum index value). Some arrays are multi-dimensional, meaning they are indexed by separate values (delimited by commas) for each dimension such as [ i, j ]. Generally, one- and two-dimensional arrays are the most common.


Single dimension array

Rows

 \/  \/

Single Column

0

 

1

 

2

 

3

 

 

Two-dimensional array

Rows

 \/   \/

Columns >>

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

1

25.75

25.25

25.10

26.25

26.00

26.40

26.70

26.90

26.50

2

1

2

3

4

5

6

7

8

9