ASSOCIATED — Status of a pointer or pointer/target pair¶
- ASSOCIATED(POINTER[, TARGET])¶
ASSOCIATED(POINTER [, TARGET])
determines the status of the pointerPOINTER
or ifPOINTER
is associated with the targetTARGET
.- Parameters
POINTER –
POINTER
shall have thePOINTER
attribute and it can be of any type.TARGET – (Optional)
TARGET
shall be a pointer or a target. It must have the same type, kind type parameter, and array rank asPOINTER
.
- Returns
ASSOCIATED(POINTER)
returns a scalar value of typeLOGICAL(4)
. There are several cases:
Standard:
Fortran 90 and later
Class:
Inquiry function
Syntax:
RESULT = ASSOCIATED(POINTER [, TARGET])
Example:
program test_associated implicit none real, target :: tgt(2) = (/1., 2./) real, pointer :: ptr(:) ptr => tgt if (associated(ptr) .eqv. .false.) call abort if (associated(ptr,tgt) .eqv. .false.) call abort end program test_associated
See also:
NULL