Reputation: 79
I am trying to understand the Fortran code contained in: http://heath.cs.illinois.edu/courses/cs598mh/george_liu.pdf
Specifically, array variable declarations in subroutines. Here is an example:
SUBROUTINE ROOTLS (ROOT, XADJ, ADJNCY, MASK, NLVL, XLS, LS)
C
INTEGER ADJNCY(1), LS(1), MASK(1), XLS(1)
INTEGER XADJ(1), I, J, JSTOP, JSTRT, LBEGIN
I am confused by the (1)
after the name of the array for example ADJNCY(1)
and XADJ(1)
. These arrays are definitely larger than one. What does the (1)
do in these declarations?
Upvotes: 3
Views: 382
Reputation: 18098
In fact, this is not FORTRAN 77, but FORTRAN 66 ;-)
The (1)
is a dirty hack in FORTRAN 66 to construct something like an assumed-size array. In FORTRAN 77 this was standardized to (*)
.
Assumed-size means that the actual of the array depends on the length of the actual array passed to the subroutine. Note, though, that the shape of the array is not necessarily preserved! Se here for an excellent explanation on this.
Upvotes: 3