FORTRAN Reference Manual

Program Units
FORTRAN Reference Manual528615-001
4-13
Adjustable Array Declarator
In the preceding program example, the declaration would be:
REAL data(*), average, sum
The asterisk indicates that the size of the numeric dummy array is the same as that of
the associated numeric actual array.
You can use the * array declarator in associated character arrays, provided the
declared element length of the associated arrays is the same.
Adjustable Array Declarator
An adjustable array declarator determines the size of a dummy through the use of a
variable dummy argument that indicates a dimension of the array. The following
example uses adjustable dimensions to yield the transposition of a matrix:
SUBROUTINE transpose (original, j, k, trans)
REAL original (j, k), trans (k, j)
DO 10 m = 1, j
DO 20 n = 1, k
trans(n,m) = orig(m,n)
20 CONTINUE
10 CONTINUE
RETURN
END
You might call TRANSPOSE as follows:
REAL matrix(8,9), tmatrix(9,8)
.
CALL transpose (matrix, 8, 9, tmatrix)
You must include the adjustable dimension declarator in the dummy argument list.
Assumed-Size Length Declarator
You can also use the asterisk (*) as an assumed-size character length declarator. In
the following subroutine, the dummy argument Y assumes the length of the associated
actual argument each time MESSAGE is called.
SUBROUTINE message(y)
CHARACTER y*(*)
PRINT *, y
END