### 2.2.3.1 Array Declarators

An array declarator specifies the symbolic name that identifies an array within a program unit and indicates the properties of that array. It takes the following form:

    a(d [,d] . . . )

a
  Is the symbolic name of the array.
d
  Is a dimension declarator that can specify both a lower bound and an upper bound:

      [dl:] du

  dl
    Is the lower bound of the dimension.
  du
    Is the upper bound of the dimension. You can use an asterisk (*) as an upper bound, but only for the last dimension of a dummy argument. An asterisk marks the declarator as an assumed-size array declarator.

The number of dimension declarators indicates the number of dimensions in the array. The number of dimensions can range from one to seven.

The value of the lower-bound dimension declarator can be negative, zero, or positive. The value of the upper-bound dimension declarator must be greater than or equal to that of the corresponding lower- bound dimension declarator. The number of elements in the dimension is du - dl + 1. If a lower bound is not specified, it is assumed to be one, and the value of the upper bound specifies the number of elements in that dimension. For example, a dimension declarator of 50 indicates that the dimension contains 50 elements.

Each dimension bound is an integer arithmetic expression in which each operand is a constant, a variable in the same dummy argument list, or a variable in a common block. The expression is converted to an integer if necessary.

The type of a variable used in a bound expression cannot be changed by a later type declaration.

Note
  Do not use array references, record field references, or references to user-defined functions in dimension bounds expressions.

You can use dimension bounds (which are not constant expressions) in a subprogram to define adjustable arrays. You can use adjustable arrays within a single subprogram to process arrays with different dimension bounds by specifying the array name as a subprogram argument, and by either specifying the bounds as subprogram arguments or by placing the bounds in a common block. Only dimension bounds that are constant expressions are permitted in a main program.

The number of elements in an array is equal to the product of the number of elements in each dimension.

An array name can appear in only one array declarator within a program unit.

For More Information:

- On the form of a symbolic name, see Section 1.3.3.

- On classes of arrays, see Section 2.2.3.6.

- On adjustable arrays, see Section 6.1.1.1.

Previous Page Next Page Table of Contents