next up previous contents
Next: External Procedures Up: Program Units Previous: Example of Scoping Issues

 

SAVE Attribute

The SAVE attribute can be:

In the above example mint, neck_jumper, stick and car all have the SAVE attribute.

Variables with the SAVE attribute are known static objects and have static storage class.

In fact, the SAVE attribute is given implicitly if an object, which is not a dummy argument or a PARAMETER, appears in an initialising declaration in a procedure, so

    INTEGER, SAVE :: NumInvocations = 0

is equivalent to

    INTEGER :: NumInvocations = 0

however, the former is clearer!

Clearly, the SAVE attribute has no meaning in the main program since when it is exited, the program has finished executing.

Objects appearing in COMMON blocks or DATA statements are automatically static.

Now try this question gif

Return to corresponding overview page gif


next up previous contents
Next: External Procedures Up: Program Units Previous: Example of Scoping Issues

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.