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:

1. C Programming Beginner’s Guide

2. Head First C: A Brain-Friendly Guide

Check The Price On Flipkart:

1. Introduction to C Programming 

2. Head First C: A Brain-Friendly Guide

Pin It on Pinterest

Share This