An array element name is an array name qualified by a subscript.
A subscript is a parenthesized list of subscript expressions. There must be one subscript expression for each dimension of the array.
The form of a subscript is:
( s [, s ] )
where s is a subscript expression. The parentheses are part of the subscript.
Example: Declare a two-by-three array with the declarator:
REAL M(2,3)
With the above declaration, you can assign a value to a particular element, as follows:
M(1,2) = 0.0
The above code assigns 0.0 to the element in row 1, column 2, of array M.
Subscript expressions have the following properties and restrictions:
A subscript expression is an integer, real, complex, logical, or byte expression. According to the FORTRAN Standard, it must be an integer expression.
A subscript expression can contain array element references and function references.
Evaluation of a function reference must not alter the value of any other subscript expression within the same subscript.
Each subscript expression is an index into the appropriate dimension of the array.
Each subscript expression must be within the bounds for the appropriate dimension of the array.
A subscript of the form ( L1, , Ln ), where each Li is the lower bound of the respective dimension, references the first element of the array.
A subscript of the form (U1, , Un), where each Ui is the upper bound of the respective dimension, references the last element of the array.
In the above example, the fourth element of V is set to zero.
Subscript expressions cannot exceed the range of INTEGER*4 in 32-bit environments. It is not controlled, but if the subscript expression is not in the range (-2147483648, 2147483647), then the results are unpredictable. When compiled for 64-bit environments, INTEGER*8 subscript expressions are allowed.