Next: External Procedures
Up: Program Units
Previous: Scope of Names
SAVE attribute can be:
- applied to a specified variable. NumInvocations is
initialised on first call and retains its new value between
calls,
SUBROUTINE Barmy(arg1,arg2)
INTEGER, SAVE :: NumInvocations = 0
NumInvocations = NumInvocations + 1
- applied to the whole procedure, and applies to all local
objects.
SUBROUTINE Mad(arg1,arg2)
REAL :: saved
SAVE
REAL :: saved_an_all
Variables with the SAVE attribute are static objects.
Clearly, SAVE has no meaning in the main program.
For more information, click here
Now try this question
Next: External Procedures
Up: Program Units
Previous: Scope of Names
©University of Liverpool, 1997
Wed May 28 23:37:18 BST 1997Not for commercial use.