CHAR(I, KIND)

Purpose

Returns the character in the given position of the collating sequence associated with the specified kind type parameter. It is the inverse of the function ICHAR.

Class

Elemental function

Argument type and attributes

I
An INTENT(IN) INTEGER. Its value must be in the range 0 ≤ I ≤ 127.
KIND (optional)
An INTENT(IN) scalar INTEGER. The actual argument corresponding to KIND must be a constant expression.

Result type and attributes

  • Character of length one.
  • If KIND is present, the kind type parameter is that specified by KIND; otherwise, the kind type parameter is that of the default character type.

Result value

  • The result is the character in position I of the collating sequence associated with the specified kind type parameter.
  • ICHAR (CHAR (I, KIND (C))) must have the value I for 0 ≤ I ≤ 127 and CHAR (ICHAR (C), KIND (C)) must have the value C for any representable character.

Examples

IBM extension begins CHAR (88) has the value 'X'.

Specific Name Argument Type Result Type Pass As Arg?
CHAR any integer default character yes  1 
Notes:
  1. IBM extension: the ability to specify a non-default integer argument.
XL Fortran supports only the ASCII collating sequence.IBM extension ends