Debian Codegraph @

doc/src/intrinsics/character/char.md

raw
1 # char(x, [, kind]): Integer to Character
2
3 Integer to character conversion.
4
5 ## Declaration
6
7 ### Syntax
8
9 ```fortran
10 retval = char(x)
11 character function char(x)
12 ```
13
14 ### Arguments
15
16 `x`: the input value of integer type.
17
18 `kind`: an optional input value of type integer constant expression for
19 initialization. This indicates the kind parameter of the result.
20
21 ### Return value
22
23 The return value is of type character of length 1.
24
25 The return value is of kind `kind` if optional input value is passed, otherwise
26 the kind is default kind.
27
28 ## Description
29
30 **char(x)** returns the character represented by the ASCII character set
31 at `x` position.
32
33 If `x` is outside the ASCII character set integer value, i.e., if `x` is not
34 represented in the ASCII character set, the return value is undefined.
35
36 It is a runtime builtin function.
37
38 ## Types
39
40 Supported argument type is integer.
41
42 ```fortran
43
44 interface
45
46 character function char(x)
47 integer, intent(in) :: x
48 end function
49
50 end interface
51 ```
52
53 ## Examples
54
55 ```fortran
56 program intrinsics_char
57 implicit none
58 character :: L = char(76)
59 print *, L
60 end program
61 ```
62
63 **Result:**
64
65 ```
66 L
67 ```
68
69 ## See Also
70
71 [achar](achar.md), [iachar](iachar.md), [ichar](ichar.md)