pointer to pointer

In C, we can use pointer to pointer, like

int **ipp;

so what is the interoperate type in Fortran.
Is that only type(C_PTR) or what is the proper representation?
This is the sample
in C

void foofunc(int **i, int *j)
  *i = j;

in Fortran, please help me to fill in the following code

subroutine fortranfunc

  subroutine foofunc(i, j) bind(c)
      use iso_c_binding
     ???? declare i, j
          integer(c_int), pointer :: j
  end subroutine
end interface

??? how to call foofunc

end fortranfunc


Hi Tuan,

I’ve never tried this myself, but would think you’d want to use C_PTR since “int" is still a pointer. Also, if you pass a C_PTR by reference to a C function, it would be a "”.

On the Fortran side, a “**” might be best represented as an array of C_PTR types. Though, it might be tricky accessing them and you’d need to associate each C_PTR with a Fortran pointer.

Sorry I couldn’t be of better help here,