This section contains descriptions for the dimension declarator and the arrays.
The lower and upper limits of each dimension are designated by a dimension declarator. The form of a dimension declarator is:
[ dd1 :] dd2 |
dd1 and dd2 are dimension bound expressions specifying the lower- and upper- bound values. They can be arithmetic expressions of type integer or real. They can be formed using constants, symbolic constants, formal arguments, or variables defined in the COMMON statement. Array references and references to user-defined functions cannot be used in the dimension bound expression. dd2 can also be an asterisk. If dd1 is not specified, a value of one is assumed. The value of dd1 must be less than or equal to dd2.
Nonconstant dimension-bound expressions can be used in a subprogram to define adjustable arrays, but not in a main program.
Noninteger dimension bound expressions are converted to integers before use. Any fractional part is truncated.
If the dimension declarator is an arithmetic expression that contains formal arguments or variables defined in the COMMON statement, then the array is called an adjustable array. In such cases, the dimension is equal to the initial value of the argument upon entry into the subprogram.
The array is called an assumed-size array when the dimension declarator contains an asterisk. In such cases, the upper bound of that dimension is not stipulated. An asterisk can only appear for formal arrays and as the upper bound of the last dimension in an array declarator.