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