C Program to find ASCII Values Of A Character

ASCII value of a character in C

 

Here, in this section we will discuss program to find the ASCII value of a character in C. ASCII value can be any integer number between 0 and 127 and consists of character variable instead of the character itself in C programming. The value derived after the programming is termed as ASCII value. With the help of casting the character to an integer, the ASCII value can be derived. Every character has an individual ASCII value that can only be an integer. Every time the character is stored into a variable, as a substitute of keeping the character itself, the ASCII value of the specific character will get stored.

 

ASCII value of a character in C

Did You Know?

 

ASCII or American Standard Code for Information Interchange is a binary code which is used by electronic equipment for electronic communications . A total of 128 character have been assigned values from 0-127
Between 65 to 90 and between 97 to 122 for Alphabets.
Between 48 to 57 for Digits.
All remaining for other characters.

 

Implementation:-

Step 1: Start

Step 2: Ask the user to insert any character

Step 3: The character will be assigned to the variable ‘a’

Step 4: Scan the character variable to find out the ASCII value of the character

Step 5: Stop

ASCII value of a character

Code to find ASCII value of character in C :-

/* C Program to identify ASCII Value of a Character */
#include<stdio.h>
#include<conio.h>  
int main()
{
  char a;
  
  printf("\n Kindly insert any character \n");
  scanf("%c",&a);
  
  printf("\n The ASCII value of inserted character = %d",a);
  return 0;
}

Output:
Kindly insert any character a
The ASCII value of inserted character = 97