I am trying to pass a single dimension array from a FORTRAN program to C.
The C function is called but the values that it holds are garbage. But whereas if I try calling the same function using an integer variable I am able to pass the required value. Can anyone help me out with this?
The code I am using is similar to this
File: fortran_prog.f
program test
real*4 :: a(4)
data a / 1,2,3,4 /
call test_func(a)
end program test
File: c_prog.c
int test_func(double a[]) {
int i;
for(i=0;i<4;i++) {
printf("%f\n",a[i]);
}
return 0;
}