An array name not qualified by a subscript identifies the entire sequence of elements of the array in certain forms where such use is permitted (5.6); however, in an EQUIVALENCE statement, an array name not qualified by a subscript identifies the first element of the array (8.2.4).

An array element name identifies one element of the sequence. The subscript value (Table 1) specifies the element of the array being identified. A different array element may be identified by changing the subscript value of the array element name.

An array name is local to a program unit (18.1.2).

A *substring* is a contiguous portion of a character datum.

a(d[,d]...)

where:

*a*is the symbolic name of the array*d*is a dimension declarator

The number of dimensions of the array is the number of dimension declarators in the array declarator. The minimum number of dimensions is one and the maximum is seven.

[d_{1}:]d_{2}

where:

*d*_{1}is the lower dimension bound*d*_{2}is the upper dimension bound

The lower and upper dimension bounds are arithmetic expressions, called *dimension bound expressions,* in which all constants, symbolic names of constants, and variables are of type integer. The upper dimension bound of the last dimension may be an asterisk in assumed-size array declarators (5.1.2). A dimension bound expression must not contain a function or array element reference. Integer variables may appear in dimension bound expressions only in adjustable array declarators (5.1.2).

If the symbolic name of a constant or variable that appears in a dimension bound expression is not of default implied integer type (4.1.2), it must be specified as integer by an IMPLICIT statement or a type-statement prior to its appearance in a dimension bound expression.

Each array declarator is either an actual array declarator or a dummy array declarator.

The properties of an array in a program unit are specified by the array declarator for the array in that program unit.

The *size of a dimension* is the value:

*d*_{2}-*d*_{1}+ 1

where:

*d*_{1}is the value of the lower dimension bound*d*_{2}is the value of the upper dimension bound

Note that if the value of the lower dimension bound is one, the size of the dimension is *d*_{2}.

The size of a dimension whose upper bound is an asterisk is not specified.

The number and size of dimensions in one array declarator may be different from the number and size of dimensions in another array declarator that is associated by common, equivalence, or argument association.

- If the actual argument corresponding to the dummy array is a noncharacter array name, the size of the dummy array is the size of the actual argument array.
- If the actual argument corresponding to the dummy array name is a noncharacter array element name with a subscript value of
*r*in an array of size*x*, the size of the dummy array is*x*+ 1 -*r*. - If the actual argument is a character array name, character array element name, or character array element substring name and begins at character storage unit
*t*of an array with*c*character storage units, then the size of the dummy array is INT((*c*+ 1 -*t*) /*ln*), where*ln*is the length of an element of the dummy array.

If an assumed-size dummy array has *n* dimensions, the product of the sizes of the first *n* - 1 dimensions must be less than or equal to the size of the array, as determined by one of the immediately preceding rules.

Whenever an array name unqualified by a subscript is used to designate the whole array (5.6), the appearance of the array name implies that the number of values to be processed is equal to the number of elements in the array and that the elements of the array are to be taken in sequential order.

a(s[,s]...)

where:

The number of subscript expressions must be equal to the number of dimensions in the array declarator for the array name.

(s[,s]...)

where *s* is a subscript expression.

Note that the term "subscript" includes the parentheses that delimit the list of subscript expressions.

Within a program unit, the value of each subscript expression must be greater than or equal to the corresponding lower dimension bound in the array declarator for the array. The value of each subscript expression must not exceed the corresponding upper dimension bound declared for the array in the program unit. If the upper dimension bound is an asterisk, the value of the corresponding subscript expression must be such that the subscript value does not exceed the size of the dummy array.

____________________________________________________________ | | | | | | n | Dimension | Subscript | Subscript | | | Declarator | | Value | |___|_____________________|______________|_________________| | | | | | | 1 | (j :k ) | (s ) | 1+(s -j ) | | | 1 1 | 1 | 1 1 | |___|_____________________|______________|_________________| | | | | | | 2 | (j :k ,j :k ) | (s ,s ) | 1+(s -j ) | | | 1 1 2 2 | 1 2 | 1 1 | | | | | +(s -j )*d | | | | | 2 2 1 | |___|_____________________|______________|_________________| | | | | | | 3 | (j :k ,j :k ,j :k ) | (s ,s ,s ) | 1+(s -j ) | | | 1 1 2 2 3 3 | 1 2 3 | 1 1 | | | | | +(s -j )*d | | | | | 2 2 1 | | | | | +(s -j )*d *d | | | | | 3 3 2 1 | |___|_____________________|______________|_________________| | | | | | |___|_____________________|______________|_________________| | | | | | | n | (j :k ,...,j :k ) | (s ,...,s ) | 1+(s -j ) | | | 1 1 n n | 1 n | 1 1 | | | | | +(s -j )*d | | | | | 2 2 1 | | | | | +(s -j )*d *d | | | | | 3 3 2 1 | | | | | +.. | | | | | +(s -j )*d | | | | | n n n-1 | | | | | *d ... d | | | | | n-2 1 | |___|_____________________|______________|_________________|Notes for Table 1:

- n is the number of dimensions, 1 <= n <= 7.
- j
_{i}is the value of the lower bound of the ith dimension. - k
_{i}is the value of the upper bound of the ith dimension. - If only the upper bound is specified, then j
_{i}% = 1. - s
_{i}is the integer value of the ith subscript expression. - d
_{i}= k_{i}-j_{i}+1 is the size of the ith dimension. If the value of the lower bound is 1, then d_{i}= k_{i}.

Note that a subscript of the form (j_{1},...j_{n}) has a subscript value of one and identifies the first element of the array. A subscript of the form (k_{1},...,k_{n}) identifies the last element of the array; its subscript value is equal to the number of elements in the array.

The subscript value and the subscript expression value are not necessarily the same, even for a one-dimensional array. In the example:

DIMENSION A(-1:8),B(10,10) A(2) = B(1,2)

A(2) identifies the fourth element of A, the subscript is (2) with a subscript value of four, and the subscript expression is 2 with a value of two. B(1,2) identifies the eleventh element of B, the subscript is (1,2) with a subscript value of eleven, and the subscript expressions are 1 and 2 with values of one and two.

An *actual array* is an array for which the array declarator is an actual array declarator. Each array in the main program is an actual array and must have a constant array declarator. A dummy array may be used as an actual argument.

An adjustable array declarator must be a dummy array declarator. At least one dummy argument list of the subprogram must contain the name of the adjustable array. A variable name that appears in a dimension bound expression of an array must also appear as a name either in every dummy argument list that contains the array name or in a common block in that subprogram.

At the time of execution of a reference to a function or subroutine containing an adjustable array in its dummy argument list, each actual argument that corresponds to a dummy argument appearing in a dimension bound expression for the array and each variable in common appearing in a dimension bound expression for the array must be defined with an integer value. The values of those dummy arguments or variables in common, together with any constants and symbolic names of constants appearing in the dimension bound expression, determine the size of the corresponding adjustable dimension for the execution of the subprogram. The sizes of the adjustable dimensions and of any constant dimensions appearing in an adjustable array declarator determine the number of elements in the array and the array element ordering. The execution of different references to a subprogram or different executions of the same reference determine possibly different properties (size of dimensions, dimension bounds, number of elements, and array element ordering) for each adjustable array in the subprogram. These properties depend on the values of any actual arguments and variables in common that are referenced in the adjustable dimension expressions in the subprogram.

During the execution of an external procedure in a subprogram containing an adjustable array, the array properties of dimension size, lower and upper dimension bounds, and array size (number of elements in the array) do not change. However, the variables involved in an adjustable dimension may be redefined or become undefined during execution of the external procedure with no effect on the above-mentioned properties.

- In a list of dummy arguments
- In a COMMON statement
- In a type-statement
- In an array declarator. Note that although the form of an array declarator may be identical to that of an array element name, an array declarator is not an array element name.
- In an EQUIVALENCE statement
- In a DATA statement
- In the list of actual arguments in a reference to an external procedure
- In the list of an input/output statement if the array is not an assumed-size dummy array
- As a unit identifier for an internal file in an input/output statement if the array is not an assumed-size dummy array
- As the format identifier in an input/output statement if the array is not an assumed-size dummy array
- In a SAVE statement

v( [e_{1}] : [e_{2}] )a(s[,s]...)( [e_{1}] : [e_{2}] )

where:

*v*is a character variable name*a*(*s*[,*s*]...) is a character array element name*e*_{1}and*e*_{2}are each an integer expression and are called*substring expressions*

The value *e*_{1} specifies the leftmost character position of the substring, and the value *e*_{2} specifies the rightmost character position. For example, A(2:4) specifies characters in positions two through four of the character variable A, and B(4,3)(1:6) specifies characters in positions one through six of the character array element B(4,3).

The values of *e*_{1} and *e*_{2} must be such that:

1 <=e_{1}<=e_{2}<=len

where *len* is the length of the character variable or array element (8.4.2). If *e*_{1} is omitted, a value of one is implied for *e*_{1}. If *e*_{2} is omitted, a value of *len* is implied for *e*_{2}. Both *e*_{1} and *e*_{2} may be omitted; for example, the form *v*(:) is equivalent to *v*, and the form *a*(*s* [,*s*]...)(:) is equivalent to *a*(*s* [,*s*]...). The length of a character
substring is *e*_{2} - *e*_{1} + 1.