ASSOCIATED intrinsic function

Standard: F77 F90 F95 F2003 F2008 Example program


<Syntax>

ASSOCIATED ( POINTER [ , TARGET ] )

POINTER : pointer of any type and rank;
TARGET : pointer, variable with the TARGET attribute, or a procedure;

Result : Logical scalar, default kind.

<Semantics>

If TARGET is present, the result is .TRUE. if POINTER is currently associated with the TARGET, and .FALSE. otherwise. Note that if POINTER is an array, TARGET must describe the same array elements in the same order to be considered to be associated. Note also that if POINTER is polymorphic, TARGET must have the same dynamic type to be considered to be associated.

If TARGET is absent, the result is .TRUE. if POINTER is currently associated, and .FALSE. if it is currently disassociated.

Note that neither POINTER nor TARGET is permitted to be an undefined pointer. A typical undefined pointer is one that has never been given an association status, or which is “dangling”. Note also that TARGET is required to be a permissible target for POINTER in a pointer assignment. This means that the type, type parameters, rank, and procedureness must match.

Fortran 2003 has procedure pointers, so POINTER can be a procedure pointer and TARGET can be a procedure.

<Related>

ALLOCATE statement, ALLOCATED intrinsic function, DEALLOCATE statement, NULL intrinsic function, NULLIFY statement, POINTER attribute, Pointer assignment statement (=>), TARGET attribute.