LF Fortran 95

POINTER Statement


The POINTER statement specifies a list of variables that have the POINTER attribute.


POINTER [::] var-name [(deferred-shape)] [, var-name [(deferred-shape)]] ... or (Cray pointer) POINTER ( int-var, target-var ) [, ( int-var, target-var ) ...]

var-name is the name of a variable.

deferred-shape is : [, :] ... where the number of colons is equal to the rank of var-name.

int-var is assumed to be an INTEGER variable, and cannot appear in a type declaration statement.

target-var is the target variable that int-var will be an alias for.


A pointer must not be referenced or defined unless it is first associated with a target through a pointer assignment or an ALLOCATE statement.

The INTENT attribute must not be specified for a variable having the POINTER attribute.

If the DIMENSION attribute is specified elsewhere in the scoping unit, the array must have a deferred shape.

int-var cannot also appear as a target-var.

int-var and target-var cannot also have the ALLOCATABLE, INTRINSIC, EXTERNAL, PARAMETER, POINTER or TARGET attributes.

Cray pointers are provided for compatibility purposes, and should not be used when writing new code.


integer,pointer :: index(:) ! pointer attribute real :: next,previous,r1(20) pointer :: next(:,:),previous ! pointer statement pointer (i,j),(k,r1) ! Cray pointers