This question already has an answer here:
- Unable to pass array from FORTRAN to C 2 answers
I am passing a single dimension array to function from Fortran program to a C. The function get called but the values it gets are garbage. Here is my code
File: abc.f
program test
real*4 :: a(4)
data a / 1,2,3,4 /
call test_func(a)
end program testFile:
File: abc.c
int test_func(double a[]) {
int i;
for(i=0;i<4;i++) {
printf("%f\n",a[i]);
}
return 0;
}
But if i pass integer instead of array then it is successfully passed.