HP Fortran Programmer's Reference (September 2007)

Arrays
Array declarations
Chapter 3 59
Array declarations
An array is a data object with the dimension attribute. Its rank—and possibly the
extents—are defined by an array specification. The array specification is enclosed in
parentheses and can be attached either to the DIMENSION attribute, as in:
INTEGER, DIMENSION(17) :: a, b
or to the array name, as in:
REAL :: y(3,25)
If the array specification is attached both to the DIMENSION attribute and to the array name in
the same declaration statement, the specification attached to the name takes precedence. In
the following example:
INTEGER, DIMENSION(4,7) :: a, b, c(15)
a and b are declared as two-dimensional arrays, but c is declared as a one-dimensional array.
An array specification can declare an array as one of the following:
Explicit-shape array
Assumed-shape array
Deferred-shape array
Assumed-size array
The following sections describe these types and the form of the array specification for each
type. For information about initializing arrays with the array constructor, see “Array
constructors” on page 75.
Explicit-shape arrays
An explicit-shape array has explicitly declared bounds for each dimension; the bounds are
neither taken from an actual array argument (“assumed”) nor otherwise specified prior to use
(“deferred”). Each dimension of an explicit-shape array has the following form:
[
lower-bound
:]
upper-bound
where
lower-bound
and
upper-bound
are specification expressions and may be positive,
negative, or zero. The default for
lower-bound
is 1.