next up previous contents
Next: Scope of Names Up: Program Units Previous: Scoping Rules

Host Association

Consider

    SUBROUTINE calculate_pay
     IMPLICIT NONE
     EXTERNAL hex
     REAL :: pay, tax
     pay = ...;  tax = ...
     CALL print_pay
    CONTAINS
     SUBROUTINE print_pay
      REAL :: tax_paid
       tax_paid = pay*tax; PRINT*, tax_paid
       CALL change_pay;    PRINT*, pay*tax
       CALL hex
     END SUBROUTINE print_pay
     SUBROUTINE change_pay
      pay = ...; tax = ...
     END SUBROUTINE change_pay
    END SUBROUTINE calculate_pay

    SUBROUTINE hex
     REAL :: pay, tax
      ...
    END SUBROUTINE hex

For more information, click here gif

Now try this question gif


next up previous contents
Next: Scope of Names Up: Program Units Previous: Scoping Rules

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.