Next: Implicit SAVE Attribute and
Up: Program Units
Previous: Scope of Names
Local objects:
- are created each time a procedure is invoked,
- are destroyed when the procedure completes,
- do not retain their values between calls.
A local variable with the SAVE attribute
will retain its value and allocation status between calls. For example,
SUBROUTINE sub1
REAL, SAVE :: keep
REAL :: chuck
REAL, ALLOCATABLE, DIMENSION(:,:), SAVE :: X
...
IF (.NOT.ALLOCATED(X)) ALLOCATE(X(20,20))
- keep and X will retain their values between calls.
- X will remain allocated between calls,
- chuck will disappear between calls,
- keep and X have static storage class.
For more information, click here
Next: Implicit SAVE Attribute and
Up: Program Units
Previous: Scope of Names
Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996Not for commercial use.