FWIW, if we know the names_n and err arguments are scalars I believe the following is a valid Fortran interface,
interface
! void demo(size_t *names_n, int *err);
subroutine demo(names_n, err) bind(c,name="demo")
use, intrinsic :: iso_c_binding, only: c_int, c_size_t
integer(c_size_t), intent(inout) :: names_n
integer(c_int), intent(inout) :: err
end subroutine
end interface
and there is no need to accept the arguments names_n, and err as type(c_ptr) (although that should also work, but involves two extra calls to c_f_pointer). The intent can be restricted if more is known about the procedure behavior.
@vickysharma0812, Is there anything else known about the value in names? Currently, your interface assumes the strings will fit into fixed-length records of 120 characters.