
Defining Variables, Arrays, And Memory |
By 'array element name' we mean an array name qualified by a subscript in paren- theses as shown in the example above. An array name not qualified by a sUbscript identifies the entire array, with one exception. In an EQUIVALENCE statement, an array name not qualified by a subscript identifies the first element of the array.
An array name is local to the program unit in which it is declared.
3.2.1 DIMENSION Statement
The format of the DIMENSION statement is:
01 M ENSION ary(d) [,ary(d)]. ..
where each 'ary(d)' is an array declarator of the form
ary(d [,d] ....)
and
ary is the symbolic name of the array
dis a dimension declarator
Dimension declarators are discussed in more detail below (section 3.2.3). In general, they indicate the number of dimensions in the array and the number of elements (or upper bound) of each dimension. The maximum number of dimensions is seven.
Examples:
LOGICAL TABLE
INTEGER ARRAY
DIMENSION TABLE(2,3), ARRAY(3,3,3)
3.2.2 Kinds of Array Declarators
An array declarator ('ary(d)' in the DIMENSION format) is either a constant, ad- justable, or
In a constant array declarator, each of the dimension bounds is a constant. An ad- justable array declarator contains one or more variables as bounds:
ARRAY(3,MI00LE,THIRD)
An
ARRAY(3,3, *)
An array name may be used as a dummy argument in a FUNCTION or SUBROUTINE subprogram. Thus, a program can have actual array declarators and dummy array declarators. An actual array declarator must be a constant array declarator, whereas dummy array declarators may be constant, adjustable, or assumed size. Like actual array declarators, dummy declarators are permitted in DIMENSION or type statements, but unlike actuals, they cannot appear in COM- MON statements. A variable name used as a dimension bound of an array must also appear in the subprogram's dummy argument list or in a common block in the sub- program. The latter requirements can be avoided using the asterisk feature for the last dimension, thereby gaining some program efficiency.