Named Constants

The ISO_C_BINDING named constants represent kind type parameters of data representations compatible with C types.

Intrinsic-Type Constants

The following table shows interoperable Fortran types and C Types.

Fortran Type Named Constant for the KIND C Type
INTEGER C_INT int
  C_SHORT short int
  C_LONG long int
  C_LONG_LONG long long int
  C_SIGNED_CHAR signed char, unsigned char
  C_SIZE_T size_t
  C_INT8_T int8_t
  C_INT16_T int16_t
  C_INT32_T int32_t
  C_INT64_T int64_t
  C_INT_LEAST8_T int_least8_t
  C_INT_LEAST16_T int_least16_t
  C_INT_LEAST32_T int_least32_t
  C_INT_LEAST64_T int_least64_t
  C_INT_FAST8_T int_fast8_t
  C_INT_FAST16_T int_fast16_t
  C_INT_FAST32_T int_fast32_t
  C_INT_FAST64_T int_fast64_t
  C_INTMAX_T intmax_t
  C_INTPTR_T intptr_t
REAL C_FLOAT float
  C_DOUBLE double
  C_LONG_DOUBLE long double
COMPLEX C_FLOAT_COMPLEX float _Complex
  C_DOUBLE_COMPLEX double _Complex
  C_LONG_DOUBLE_COMPLEX long double _Complex
LOGICAL C_BOOL _Bool
CHARACTER1 C_CHAR char
1 For character type, the length type parameter must be omitted or it must be specified by an initialization expression whose value is one.

For example, an integer type with the kind type parameter C_LONG is interoperable with the C integer type "long" or any C type derived from "long".

The value of C_INT will be a valid value for an integer kind type parameter on the processor. The values for the other integer named constants (C_INT*) will be a valid value for an integer kind type parameter on the processor, if any, or one of the following:

The values of C_FLOAT, C_DOUBLE, and C_LONGDOUBLE will be a valid value for a real kind type parameter on the processor, if any, or one of the following:

The values of C_FLOAT_COMPLEX, C_DOUBLE_COMPLEX, and C_LONG_DOUBLE_COMPLEX will be the same as those of C_FLOAT, C_DOUBLE, and C_LONG_DOUBLE, respectively.

The value of C_BOOL will be a valid value for a logical kind parameter on the processor, if any, or -1.

The value of C_CHAR is the character kind.

Character Constants

The following table shows interoperable named constants and C characters:

Fortran Named Constant Definition C Character
C_NULL_CHAR null character '\0'
C_ALERT alert '\a'
C_BACKSPACE backspace '\b'
C_FORM_FEED form feed '\f'
C_NEW_LINE new line '\n'
C_CARRIAGE_RETURN carriage return '\r'
C_HORIZONTAL_TAB horizontal tab '\t'
C_VERTICAL_TAB vertical tab '\v'

Derived-Type Constants

The constant C_NULL_PTR is of type C_PTR; it has the value of a C null data pointer. The constant C_NULL_FUNPTR is of type C_FUNPTR; it has the value of a C null function pointer.