Next: Function Syntax
Up: Subroutine Syntax
Previous: Subroutine Example
An external procedure may invoke a further external procedure,
SUBROUTINE sub1(a,b,c)
IMPLICIT NONE
EXTERNAL sum_sq
REAL :: a, b, c, s
...
CALL sum_sq(a,b,c,s)
...
END SUBROUTINE sub1
calls,
SUBROUTINE sum_sq(aa,bb,cc,ss)
IMPLICIT NONE
REAL, INTENT(IN) :: aa, bb, cc
REAL, INTENT(OUT) :: ss
ss = aa*aa + bb*bb + cc*cc
END SUBROUTINE sum_sq
The principle is the same as for calling an internal procedure except
that:
- whereas an internal procedure has access to the host's declarations
(and so inherits, amongst other things,
the IMPLICIT NONE) external procedures do not. An
IMPLICIT NONE is needed in every external procedure.
- the external procedure should be declared in an EXTERNAL
statement. (This is optional but is good practise.)
Now try this question
Next: Function Syntax
Up: Subroutine Syntax
Previous: Subroutine Example
Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996Not for commercial use.