What is asc value of a character?
Every character in C programming is given an integer value to represent it. That integer value is known as ASCII value of that character. For example: ASCII value of 'a' is 97. When a character is stored in variable of typechar
, the ASCII value of character is stored instead of that character itself character itself. For example: If you try to store character 'a' in a char type variable, ASCII value of that character is stored which is 97.
In, this program user is asked to enter a character and this program will display the ASCII value of that character.
Source Code
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
printf("\n enter the chareater:");
scanf("%c",&ch);
printf("the ASC value of %c is %d",ch,ch);
getch();
}
******************************output************************************
|
Output of the program to convert char in to ASCII code |
No comments