The most important difference is the index order. Fortran uses mathematical notation, so the first index is the column index, the second is the row. C is different, and the first index is a string.
The macro explains this
#define AccessFortranArray(ArrayName, i,j) ArrayName[j][i]
To do something like (1: n, 2), it is impossible to do in C, only creating a temporary array and extracting elements in a loop (except when you want to extract a series of lines - in this case, when you can use pointer arithmetic in C)
There are good links for C β Fortran interop, like this one
Here's also a multi-dimensional pattern: Transferring an array to / from Fortran
"One more thing."
C function names must have an underscore at the end to be visible in Fortran. They must also be lowercase. All this applies to the gcc / gfortran pair.
And one more. You said you could pass an array so you know (Jim Balter comments in a comment) that Fortran arrays are based on 1 and C arrays are based on 0.
And the third one. If all you need is a large data block, then instead of messing around with link layout settings and function calls, use a COMMON block.
Like this
extern struct { double arr[100]; } thearr_;
And fortran:
real*8 arr(100) common/TheArr/ arr
source share