pass 2D string array from Fortran to C

pass 2D string array from Fortran to C

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.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Jugoslav www.xeffort.com

Login to leave a comment.