pass 2D string array from Fortran to C

pass 2D string array from Fortran to C

A string array is declared in Fortran as:

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today