Next: CHDIR, Previous: CEILING, Up: Intrinsic Procedures [Contents][Index]
CHAR — Character conversion functionCHAR(I [, KIND]) returns the character represented by the integer I.
Fortran 77 and later
Elemental function
RESULT = CHAR(I [, KIND])
| I | The type shall be INTEGER. |
| KIND | (Optional) An INTEGER initialization
expression indicating the kind parameter of the result. |
The return value is of type CHARACTER(1)
program test_char
integer :: i = 74
character(1) :: c
c = char(i)
print *, i, c ! returns 'J'
end program test_char
| Name | Argument | Return type | Standard |
CHAR(I) | INTEGER I | CHARACTER(LEN=1) | Fortran 77 and later |
See ICHAR for a discussion of converting between numerical values and formatted string representations.