C Program to Find ASCII Value of a Character
Before writing a C program, first let us understand what is ASCII?
ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard that is used for electronic communication.
Program
Let's understand Program
In this program, the user is asked to enter a character. The character is stored in variable ch
.
When %d
format specifier is used, the ASCII value of character ch
is displayed.
When %c
format specifier is used, the character entered by user is displayed.
Output 1
Output 2
Let's understand outputs
In Output 1, the user entered character C
, so the output of character C
is 67 (ASCII value).
In Output 2, the user entered character 5
, so the output of character 5
is 53 (ASCII value).
Join Our Social Media Connections
0 Comments