Corresponding Data Types

The following table shows the correspondence between the data types available in C/C++, Fortran, and Pascal. Several data types in C have no equivalent representation in Pascal or Fortran. Do not use them when programming for interlanguage calls. Blank table cells indicate that no matching data type exists.

Correspondence of Data Types among C, C++, Fortran, and Pascal
C and C++ Data Types Fortran Data Types
Pascal Data Types
bool LOGICAL*4  
char CHARACTER CHAR
signed char INTEGER*1
BYTE
PACKED -128..127
unsigned char LOGICAL*1 PACKED 0..255
signed short int INTEGER*2 PACKED -32768..32767
unsigned short int LOGICAL*2 PACKED 0..65535
signed long int INTEGER*4 INTEGER
unsigned long int LOGICAL*4 --
signed long long int INTEGER*8 --
unsigned long long int LOGICAL*8 --
float REAL
REAL*4
SHORTREAL
double REAL*8
DOUBLE PRECISION
REAL
long double (default) REAL*8
DOUBLE PRECISION
REAL
long double (with -qlongdouble or -qldbl128) REAL*16 --
structure of two floats COMPLEX
COMPLEX*4
RECORD of two SHORTREALS
structure of two doubles COMPLEX*16
DOUBLE COMPLEX
RECORD of two REALS
struct of two long doubles (default) COMPLEX*16 --
struct -- RECORD (see notes below)
enumeration INTEGER*4 Enumeration
char[n] CHARACTER*n PACKED ARRAY[1..n] OF CHAR
array pointer (*) to type Dimensioned variable (transposed) ARRAY
pointer (*) to function Functional Parameter Functional Parameter
structure (with -qalign=packed) Sequence derived type PACKED RECORD

Special Treatment of Character and Aggregate Data
Most numeric data types have counterparts across the three languages. Character and aggregate data types require special treatment:



Interlanguage Calling Conventions
Use the Subroutine Linkage Conventions in Interlanguage Calls
Sample Program: C Calling Fortran