Lahey/Fujitsu Fortran

Pointer Assignment Statement

Description

The pointer assignment statement associates a pointer with a target.

Syntax

pointer => target
Where:

pointer is a variable having the POINTER attribute.

target is a variable or expression having the TARGET or POINTER attribute, or is a subobject of a variable having the TARGET attribute.

Remarks

If target is not a pointer, pointer becomes associated with target.

If target is an associated pointer, pointer becomes associated with the same object as target.

If target is disassociated, pointer becomes disassociated.

If target's association status is undefined, pointer's also becomes undefined.

Pointer assignment of a pointer component of a structure can also take place by derived type intrinsic assignment or by a defined assignment.

When a pointer assignment statement is executed, any previous association of pointer is broken.

target must be of the same type, kind, and rank as pointer.

target must not be an array section with a vector subscript.

If target is an expression, it must deliver a pointer result.

Example

real,pointer :: a => null(),b => null() real,target :: c=5.0 a => c ! a is an alias for b b => a ! b is an alias for a (and c) write(*,*) a,b,c