Explicit-shape arrays
Explicit-shape arrays are arrays where the bounds are explicitly specified for each dimension.
Explicit_shape_spec_list
- lower_bound, upper_bound
- are specification expressions
Arrays with bounds that are nonconstant expressions
must be declared inside subprograms or
BLOCK constructs
. The nonconstant bounds are determined on entry to the subprogram
or
BLOCK construct
. If a lower bound is omitted, its default value is one.
The rank is the number of specified upper bounds. The shape of an explicit-shape dummy argument can differ from that of the corresponding actual argument.
The size is determined by the specified bounds.
The size of an explicit-shape dummy argument does not need to be the same as the size of the actual argument, but the size of the dummy argument cannot be larger than the size of the actual argument.
You can specify the VALUE attribute
on explicit-shape arrays.
Examples
INTEGER A,B,C(1:10,-5:5) ! All bounds are constant
A=8; B=3
CALL SUB1(A,B,C)
END
SUBROUTINE SUB1(X,Y,Z)
INTEGER X,Y,Z(X,Y) ! Some bounds are not constant
END SUBROUTINE