215. Fortran array x(n1,n2) passed to C array x[n2][n1]#

topic: Interoperability with C and C++

Note

This tip is a draft1.

A Fortran array

real x(n1,n2)

matches a C array

float x[n2][n1]

Matrices can be passed to C99 variable length arrays. A procedure with explicit-shape arrays calling C can be wrapped in a procedure with assumed-shape array arguments for ease of use.



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.