Home » C Programs » C Program to Print Ascii Value

C Program to Print Ascii Value

C Program to print ascii value of all characters to print the ASCII value of characters or letters in a c programming language

ASCII Code Definition

The American Standard Code For Information Interchange (ASCII) is a standard data-transmission code used by smaller and less powerful computers to convey both textual data (letters, numbers, and punctuation marks) and non-input-device commands (control characters). 

ASCII stands for American Standard Code for Information Interchange and is pronounced ask-ee. It’s a numbering system that assigns a number from 0 to 127 to each letter in 128 English letters. The ASCII code for uppercase M, for example, is 77. Here you can learn how to execute c program to print ascii value of all characters

Purpose of ASCII Code

ASCII’s goal is to provide a standard for character sets used in electronic devices. The standard assures that different device (made by different firms) can interact with one another using the same character code. Because ASCII code only includes 256 characters, it takes up less space. All alphanumeric characters are saved. In comparison to Unicode, ASCII has a lower memory demand.

C Program to Print Ascii Value

//c program to print ascii value 
#include<stdio.h> 
int main() 
{ 
char c;
printf("Enter a letter");
scanf("%c", &c);
printf("ASCII Value %c = %d", c, c);
}

Output:

Enter a letter r
ASCII Value r = 114