The POINTER statement discussed here is different from the one discussed in Section 5.15. It establishes pairs of variables and pointers, in which each pointer contains the address of its paired variable.
This POINTER statement takes the following form:
POINTER (pointer,pointee) [,(pointer,pointee)] . . .
The following are pointer rules and behavior:
ALLOCATABLE | INTRINSIC | POINTER |
EXTERNAL | PARAMETER | TARGET |
A pointer can appear in a DATA statement with integer literals only.
malloc(3f)
on
Tru64 UNIX systems or LIB$GET_VM on OpenVMS systems)
For example:
Using %LOC: Using MALLOC: Using LIB$GET_VM: INTEGER I(10) INTEGER I(10) INTEGER I(10) INTEGER I1(10) /10*10/ POINTER (P,I) INTEGER LIB$GET_VM,STATUS POINTER (P,I) P = MALLOC(40) POINTER (P,I) P = %LOC(I1) I(2) = I(2) + 1 STATUS = LIB$GET_VM(P,40) I(2) = I(2) + 1 IF (.NOT. STATUS) CALL EXIT(STATUS) I(2) = I(2) + 1
The following are pointee rules and behavior:
ALLOCATABLE | OPTIONAL | SAVE |
AUTOMATIC | PARAMETER | STATIC |
INTENT | POINTER | TARGET |