Ascii to int | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Ascii to int

can anyone suggest me how to convert any integer to its ASCII code and vice versa using c language

4th Apr 2018, 11:50 AM
Harish Vellala
Harish Vellala - avatar
2 Answers
+ 2
int x = 49; char c = char(x) char c = 'a' int x = int(c)
4th Apr 2018, 12:03 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
0
This prints the ascii value of lowercase 'a' and convert ascii 97 to its character equivalent : 'a' #include <stdio.h> int main() { char x = 'a' ; printf("%d\n", x) ; int y = 97; printf("%c", y) ; return 0; }
4th Apr 2018, 11:56 AM
Bishal Sarang
Bishal Sarang - avatar