Array types

Arrays occupy a contiguous area of memory, with the lowest subscriptedelement at the lowest address.  The size of an array is the element size multipliedby the number of elements.

Multidimensional arrays are stored as arrays of arrays.  Asyou step through the elements of a multidimensional array in memory, the first subscriptvaries less rapidly than the second, the second less rapidly than the third, andso on.  

For example:

Modula-2

X : array [1..2], [1..2] of integer;
X : array [1..2, 1..2] of integer;

is stored in memory in the following order:

X[1,1]
X[1,2]
X[2,1]
X[2,2]

Ada95

type arrayType is array (range 1..2, range 1..2) of integer;

X : arrayType;

is stored in memory in the following order:

X(1,1)
X(1,2)
X(2,1)
X(2,2)