Fortran Wiki
char

Description

char(i [, kind]) returns the character represented by the integer i.

Standard

FORTRAN 77 and later

Class

Elemental function

Syntax

result = char(i [, kind])

Arguments

  • i - The type shall be integer.
  • kind - (Optional) An integer initialization expression indicating the kind parameter of the result.

Return value

The return value is of type character(1)

Example

program test_char
    integer :: i = 74
    character(1) :: c
    c = char(i)
    print *, i, c ! returns 'J'
end program test_char

Note

See ichar for a discussion of converting between numerical values and formatted string representations.

See also

achar, iachar, ichar

category: intrinsics