Program to print ASCII Value
In C programming, a character variable holds ASCII value (an integer number between 0 and 127) rather than that character itself. That value is known as it’s ASCII value. For example, the ASCII value of 'A'
is 65.
What this means is that, if you assign 'A'
to a character variable, 65 is stored in the variable rather than 'A'
itself. Now, let’s see how we can print the ASCII value of characters in C programming.
Example:
Output:
Code Explanation
In this program, the user is asked to enter a character. The character is stored in variable c. When %d
the format string is used, 71 (the ASCII value of G
) is displayed. When %c
format string is used, 'G'
itself is displayed.
Top Book Suggestion
The two books on C Programming Language that I Personally Recommend. I really loved reading these books. These books are listed for quality content, easy steps, and affordable price. You can get it from Amazon and Flipkart.
Check The Price On Amazon:
Check The Price On Flipkart:
Buy Premium Courses At Lowest Price. Become A Certified Developer Today!
Important C Programs
Basic C Programs
Programs On Number
String Programs
Array Programs
Sorting Programs
Pointer Programs
Star Pattern Programs
Number Pattern Programs
File Handling Programs
Programs On Recursion
Geometry Programs
Programs On Loop
Programs On Function
Switch Case Programs
If Else Programs
Bitwise Operator
Conditional Operator
Matrix Programs
Program On Calculation
Number System Conversion
All C programs