Table that follows shows a simple correspondence between most types of Fortran and C data.
Fortran |
C |
integer*1 x |
char x; |
integer*2 x |
short int x; |
integer*4 x |
long int x; |
integer x |
long int x; |
integer*8 x |
long long x; |
logical*1 x |
char x; |
logical*2 x |
short int x; |
logical*4x |
long int x; |
logical x |
long int x; |
logical*8 x |
long long x; |
real*4 x |
float x; |
real*8 x |
double x; |
real x |
float x; |
real*16 |
No equivalent |
double precision x |
double x; |
complex x |
struct {float real, imag;} x; |
complex*8 x |
struct {float real, imag;} x; |
complex*16 x |
struct {double dreal, dimag;} x; |
double complex x |
struct {double dreal, dimag;} x; |
complex(KIND=16)x |
No equivalent |
character*6 x |
char x[6]; |
Example below illustrates the correspondence shown in the table above: a simple Fortran call and its corresponding call to a C procedure. In this example the arguments to the C procedure are declared as pointers.
Fortran Call |
C Called Procedure |
Note
The character data or complex
data do not have a simple correspondence to C types.