MULTIDIMENSIONAL ARRAYS

The arrays created in the above examples are called one-dimensional arrays since they have only one set of index.

A two-dimensional array having two indices can be declared in a similar way.

For example to keep track of the 4 examination scores for each of the students in in a class of 65 students, you can declare

Dim Scores(1 to 65, 1 to 4) As Integer
The j-th exam score for the i-th student is stored in Scores(i, j).

Thus if the 5-th student has a score of 87 in the second examination, then you can assign the value, after the array Scores has been declared, as:

Scores(5, 2) = 87
A two-dimensional array is like the matrix that you encounter in linear algebra.

In a similar fashion, one can declare and use three and higher dimensional arrays.