Table 11.5 shows how to declare numeric variables of similar type in different languages.
Table 11.5 Equivalent Numeric Data Types
BASIC | C/C++ | FORTRAN | Pascal |
x% | short | INTEGER*2 | INTEGER2 |
INTEGER | int | —- | INTEGER (default) |
—- | unsigned short1 | —- | WORD |
—- | unsigned | —- | —- |
x& | long | INTEGER*4 | INTEGER4 |
LONG | —- | INTEGER (default) | —- |
—- | unsigned long1 | —- | —- |
x! | float | REAL*4 | REAL4 |
x (default) | —- | REAL | REAL (default) |
SINGLE | —- | —- | —- |
x# | double | REAL*8 | REAL8 |
DOUBLE | —- | DOUBLE PRECISION | —- |
—- | long double | —- | —- |
—- | unsigned char | CHARACTER*12 | CHAR |
1 Types unsigned short and unsigned long are not supported by BASIC or FORTRAN. Type unsigned long is not supported by Pascal. A signed integral type can be substituted, but the maximum range will be less.
2 The FORTRAN type CHARACTER*1 is not the same as LOGICAL.
The FORTRAN types COMPLEX*8 and COMPLEX*16 are not implemented in C but can be represented with structures.
The FORTRAN types LOGICAL*2 and LOGICAL*4 are not implemented in C. LOGICAL*2 is stored as a one-byte Boolean indicator followed by an unused byte; LOGICAL*4 is stored as a one-byte Boolean indicator followed by three unused bytes.