An explicit-shape array is declared with explicit values for the
bounds in each dimension of the array. An explicit-shape
specification takes the following form:
[lower-bound:] upper-bound [,[lower-bound:] upper-bound ]...
The lower bound (if present) and the upper bound are specification
expressions that have a positive, negative, or zero value. If
necessary, the bound value is converted to integer type.
If the lower bound is not specified, it is assumed to be 1.
The bounds can be specified as constant or nonconstant expressions,
as follows:
o If the bounds are constant expressions, the subscript range of
the array in a dimension is the set of integer values between
and including the lower and upper bounds. If the lower bound
is greater than the upper bound, the range is empty, the extent
in that dimension is zero, and the array has a size of zero.
o If the bounds are nonconstant expressions, the array must be
declared in a procedure. The bounds can have different values
each time the procedure is executed, since they are determined
when the procedure is entered.
The bounds are not affected by any redefinition or undefinition
of the specification variables that occurs while the procedure
is executing.
The following explicit-shape arrays can specify nonconstant
bounds:
- An automatic array (the array is a local
variable)
- An adjustable array (the array is a dummy
argument to a subprogram)
The following are examples of explicit-shape specifications:
INTEGER I(3:8, -2:5) ! Rank-two array; range of dimension one is
... ! 3 to 8, range of dimension two is -2 to 5
SUBROUTINE SUB(A, B, C)
INTEGER :: B, C
REAL, DIMENSION(B:C) :: A ! Rank-one array; range is B to C
Additional Information:
explode
extract