Complex Types

To pass a complex or double complex argument to a C procedure, declare the corresponding argument in the C procedure as either of the two following structures, depending on whether the actual argument is complex or double complex:

struct { float real, imag; } *complex;
struct { double real, imag; } *dcomplex;

Example below shows Fortran code for passing a complex type called compl and the corresponding C procedure.

Example of Complex Types Passed from Fortran to C

Fortran Code
double complex dc
complex c  
call compl( dc, c)

Corresponding C Procedure
compl ( dc, c )
struct { double real, imag; } *dc;
struct { float real, imag; } *c;
{
. . .program text. . .
}