find ASCII value of character

In this example, We are going to take one character input from user and print ASCII Value of that character.

What is ASCII Value?

The full form of ASCII is the American Standard Code for information interchange. It is a character encoding scheme used for electronics communication. Each character or a special character is represented by some ASCII code, and each ascii code occupies 7 bits in memory.

C Program to Find ASCII Value of Character :

In C programming language, a character variable does not contain a character value itself rather the ascii value of the character variable. The ascii value represents the character variable in numbers, and each character variable is assigned with some number range from 0 to 127. For example, the ascii value of 'A' is 65.

Example :

int main(){
    char c;
    printf("Please enter a character: ");
    scanf("%c", &c); 
    printf("ASCII value of %c is %d\n", c, c);
    return 0;

Output :

        //Output :- 1
		Please enter a character: A
		ASCII value of c is 65
		//Output :- 2
		Please enter a character: c
		ASCII value of c is 99 

Share your thoughts

Ask anything about this examples