C_F_POINTER(3f)

DESCRIPTION
C_F_POINTER(CPTR, FPTR[, SHAPE]) assigns the target of the C pointer CPTR to the Fortran pointer FPTR and specifies its shape.

STANDARD
Fortran 2003 and later

CLASS
Subroutine

SYNTAX
CALL C_F_POINTER(CPTR, FPTR[, SHAPE])

ARGUMENTS

CPTR scalar of the type C_PTR. It is INTENT(IN). FPTR pointer interoperable with cptr. It is INTENT(OUT). SHAPE (Optional) Rank-one array of type INTEGER with INTENT(IN). It shall be present if and only if fptr is an array. The size must be equal to the rank of fptr.

EXAMPLE
          program main
            use iso_c_binding
            implicit none
            interface
              subroutine my_routine(p) bind(c,name='myC_func')
                import :: c_ptr
                type(c_ptr), intent(out) :: p
              end subroutine
            end interface
            type(c_ptr) :: cptr
            real,pointer :: a(:)
            call my_routine(cptr)
            call c_f_pointer(cptr, a, [12])
          end program main

SEE ALSO
C_LOC, C_F_PROCPOINTER

AUTHOR

This information was taken from the GFortran documentation (https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gfortran/) and converted to a manpage by AstroFloyd (http://astrofloyd.org).