Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

pass 2D string array from Fortran to C

jq2000
Beginner
406 Views
A string array is declared in Fortran as:
CHARACTER*9 ARRAY(1000)

How can I pass it to a C function as an argument? I need to access it's content and update it. Using a pointer to pointer as an array name in C obviously does not work.
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
406 Views
Just pass the address of Array(1). In C, you can treat it as char* (of length 9000) and code using calculated offsets (i.e. Array[3*9+2] is Array(4)(2:2)). I think you can also declare the argument as char Array[1000][9] (or Array[9][1000]? -- I always mix these) but I'm not versatile enough with C to tell you offhand. It's worth a try.
0 Kudos
Reply