W3cubDocs

/GNU Fortran 6

9.55 CHAR — Character conversion function

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
Specific names:
Name Argument Return type Standard
CHAR(I) INTEGER I CHARACTER(LEN=1) F77 and later
Note:
See ICHAR for a discussion of converting between numerical values and formatted string representations.
See also:
ACHAR, IACHAR, ICHAR

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gfortran/CHAR.html