The following table shows the correspondence between the data types available in C/C+ and Fortran. Several data types in C have no equivalent representation in Fortran. Do not use them when programming for interlanguage calls.

C and C++ data types | Fortran data types |
---|---|

bool (C++)_Bool (C) | LOGICAL(1) |

char | CHARACTER |

signed char | INTEGER*1 |

unsigned char | LOGICAL*1 |

signed short int | INTEGER*2 |

unsigned short int | LOGICAL*2 |

signed long int | INTEGER*4 |

unsigned long int | LOGICAL*4 |

signed long long int | INTEGER*8 |

unsigned long long int | LOGICAL*8 |

float | REAL REAL*4 |

double | REAL*8 DOUBLE PRECISION |

long double (default) | REAL*8 DOUBLE PRECISION |

long double (with -qlongdouble or -qldbl128) | REAL*16 |

float _Complex | COMPLEX*8 or COMPLEX(4) |

double _Complex | COMPLEX*16 or COMPLEX(8) |

long double _Complex (default) | COMPLEX*16 or COMPLEX(8) |

long double _Complex(with -qlongdouble or -qldbl128) | COMPLEX*32 or COMPLEX(16) |

structure | -- |

enumeration | INTEGER*4 |

char[n] | CHARACTER*n |

array pointer to type, or type [] | Dimensioned variable (transposed) |

pointer to function | Functional parameter |

structure (with -qalign=packed) | Sequence derived type |