# Variables

A scalar Fortran variable is interoperable if its type and type parameters are interoperable and it is not a pointer.

An array Fortran variable is interoperable if its type and type parameters are interoperable and it has an explicit shape or assumed size. It interoperates with a C array of the same type, type parameters, and shape, but with subscripts reversed.

For example, a Fortran array declared as `integer :: a(18, 3:7, *)` is interoperable with a C array declared as `int b[][5][18]`.

Scalar variables are interoperable only if their type parameters (kind and length) are interoperable (see above), they are not a coarray, do not have the POINTER or ALLOCATABLE attribute, and if character length is not assumed nor defined by a non-constant expression.

Arrays are interoperable if the base type meets the scalar variable requirements above, if they are explicit shape or assumed-size, and are not zero-sized. Furthermore, assumed-size arrays are interoperable only with C arrays that have no size specified. An allocatable array, coarray, or array pointer is not interoperable.

Parent topic: Standard Tools for Interoperability