next up previous contents
Next: Automatic Arrays Up: Procedures and Array Arguments Previous: Explicit-shape Arrays

 

Assumed-shape Arrays

 

Declaring dummy arrays as assumed-shape arrays is the recommended method in Fortran 90. Consider,

    PROGRAM TV
     IMPLICIT NONE
      ...
      REAL, DIMENSION(40)    :: X
      REAL, DIMENSION(40,40) :: Y
       ...
      CALL gimlet(X,Y)
      CALL gimlet(X(1:39:2),Y(2:4,4:4))
      CALL gimlet(X(1:39:2),Y(2:4,4)) ! invalid
      ...
    CONTAINS 
     SUBROUTINE gimlet(a,b)
      REAL, INTENT(IN)   :: a(:), b(:,:)
      ...
     END SUBROUTINE gimlet
    END PROGRAM TV

An assumed-shape array declaration must have the same type, rank and kind as the actual argument. The compiler will insist on this.

Note:

The third call is invalid because the second section reference has one dimensions whereas the declaration of the dummy has two.

Return to corresponding overview page gif


next up previous contents
Next: Automatic Arrays Up: Procedures and Array Arguments Previous: Explicit-shape Arrays

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.