2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
8 C_ASSOCIATED --- Status of a C pointer
9 **************************************
11 .. index:: C_ASSOCIATED, association status, C pointer, pointer, C association status
13 .. function:: C_ASSOCIATED(c_ptr_1, c_ptr_2)
15 ``C_ASSOCIATED(c_ptr_1[, c_ptr_2])`` determines the status of the C pointer
16 :samp:`{c_ptr_1}` or if :samp:`{c_ptr_1}` is associated with the target :samp:`{c_ptr_2}`.
19 Scalar of the type ``C_PTR`` or ``C_FUNPTR``.
22 (Optional) Scalar of the same type as :samp:`{c_ptr_1}`.
25 The return value is of type ``LOGICAL`` ; it is ``.false.`` if either
26 :samp:`{c_ptr_1}` is a C NULL pointer or if :samp:`{c_ptr1}` and :samp:`{c_ptr_2}`
27 point to different addresses.
30 Fortran 2003 and later
36 .. code-block:: fortran
38 RESULT = C_ASSOCIATED(c_ptr_1[, c_ptr_2])
41 .. code-block:: fortran
43 subroutine association_test(a,b)
44 use iso_c_binding, only: c_associated, c_loc, c_ptr
48 if(c_associated(b, c_loc(a))) &
49 stop 'b and a do not point to same target'
50 end subroutine association_test