CHAR — Character conversion function¶
- CHAR(I[, KIND])¶
CHAR(I [, KIND])returns the character represented by the integerI.- Parameters
I – The type shall be
INTEGER.KIND – (Optional) An
INTEGERinitialization expression indicating the kind parameter of the result.
- Returns
The return value is of type
CHARACTER(1)
Standard:Fortran 77 and later
Class:Elemental function
Syntax:RESULT = CHAR(I [, KIND])
Example:program test_char integer :: i = 74 character(1) :: c c = char(i) print *, i, c ! returns 'J' end program test_char
Specific names:Name
Argument
Return type
Standard
CHAR(I)INTEGER ICHARACTER(LEN=1)Fortran 77 and later
Note:See ICHAR for a discussion of converting between numerical values and formatted string representations.
See also:ACHAR, IACHAR, ICHAR