next up previous contents
Next: SAVE Attribute and the Up: Program Units Previous: Host Association - Global

 

Scope of Names

Consider the following example,

    PROGRAM Proggie  
     IMPLICIT NONE
     REAL ::  A, B, C
     CALL sub(A)    
    CONTAINS
     SUBROUTINE Sub(D) 
      REAL :: D      ! D is dummy (alias for A)
      REAL :: C      ! local C (diff to Proggie's C)
       C = A**3      ! A cannot be changed
       D = D**3 + C  ! D can be changed
       B = C         ! B from Proggie gets new value
     END SUBROUTINE Sub
    END PROGRAM Proggie

In Sub, as A is argument associated it may not be have its value changed but may be referenced.

C in Sub is totally separate from C in Proggie, changing its value in Sub does not alter the value of C in Proggie.

For more information, click here gif

Now try this question gif

 


next up previous contents
Next: SAVE Attribute and the Up: Program Units Previous: Host Association - Global

©University of Liverpool, 1997
Wed May 28 23:37:18 BST 1997
Not for commercial use.