FORTRAN 77 Language Reference

Array Subscripts

An array element name is an array name qualified by a subscript.

Form of 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

Subscript expressions have the following properties and restrictions:

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.