XL Fortran for AIX 8.1

Language Reference


ASSOCIATED(POINTER, TARGET)

Returns the association status of its pointer argument, or indicates whether the pointer is associated with the target.

POINTER
A pointer whose association status you want to test. It can be of any type. Its association status must not be undefined.

TARGET (optional)
A pointer or target that might or might not be associated with POINTER. Its association status must not be undefined.

Class

Inquiry function

Result Type and Attributes

Default logical scalar.

Result Value

If only the POINTER argument is specified, the result is .TRUE. if it is associated with any target and .FALSE. otherwise. If TARGET is also specified, the procedure tests whether POINTER is associated with TARGET, or with the same object that TARGET is associated with (if TARGET is also pointer).

The result is undefined if either POINTER or TARGET is associated with a zero-sized array, or if TARGET is a zero-sized array.

Objects with different types or shapes cannot be associated with each other.

Arrays with the same type and shape but different bounds can be associated with each other.

Examples

REAL, POINTER, DIMENSION(:,:) :: A
REAL, TARGET, DIMENSION(5,10) :: B, C
 
NULLIFY (A)
PRINT *, ASSOCIATED (A)   ! False, not associated yet
 
A => B
PRINT *, ASSOCIATED (A)   ! True, because A is
                          ! associated with B
 
PRINT *, ASSOCIATED (A,C) ! False, A is not
                          ! associated with C
END


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]