The POINTER attribute specifies that an object is a pointer (a dynamic variable). A pointer does not contain data, but points to a scalar or array variable where data is stored. A pointer has no initial storage set aside for it; memory storage is created for the pointer as a program runs.
The POINTER attribute can be specified in a type declaration statement or a POINTER statement, and takes one of the following forms:
Type Declaration Statement:
Rules and Behavior
No storage space is created for a pointer until it is allocated with an ALLOCATE statement or until it is assigned to a allocated target. A pointer must not be referenced or defined until memory is associated with it.
Each pointer has an association status, which tells whether the pointer is currently associated with a target object. When a pointer is initially declared, its status is undefined. You can use the ASSOCIATED intrinsic function to find the association status of a pointer.
If the pointer is an array, and it is given the DIMENSION attribute elsewhere in the program, it must be declared as a deferred-shape array.
A pointer cannot be specified in a DATA, EQUIVALENCE, or NAMELIST statement.
The following example shows type declaration statements specifying the POINTER attribute:
TYPE(SYSTEM), POINTER :: CURRENT, LAST REAL, DIMENSION(:,:), POINTER :: I, J, REVERSE
The following is an example of the POINTER statement:
TYPE(SYSTEM) :: TODAYS POINTER :: TODAYS, A(:,:)
For More Information: