FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-17
Array Size
Array Size
The number of elements in an array is equal to the product of the number of elements
in each dimension of the array.
Storage Order
FORTRAN stores array elements as a linear sequence of words. The type and the
number of elements in an array determine the number of words of memory FORTRAN
reserves for the array.
FORTRAN reserves one word of storage for each element in an array of one-word
elements, two times the number of elements for an array of doubleword elements, and
four times the number of elements for an array of quadrupleword elements. For
character arrays, the number of storage words allocated equals half the number of
characters in each element of the array times the number of elements in the array.
The following array requires storage for 200 characters or 100 storage words:
CHARACTER * 10 product (20)
FORTRAN stores array elements in ascending locations by columns. The first
(leftmost) subscript increases most rapidly, the last (rightmost) subscript increases
least rapidly. Figure 2-2 on page 2-18 shows the storage order for the following array:
DIMENSION income(2,3,4)
j
i
k
i
n
i
s
i
Lower bound of dimension i.
Upper bound of dimension i.
Size of dimension i. If the lower bound is one, n
i
= k
i
. Otherwise, n
i
= (k
i
- j
i
+ 1).
Value of the subscript expression specified for dimension i.
Table 2-5. Calculating Array Element Storage Locations (page 2 of 2)
Dimensions Position of Array Element