A Program to Find ASCII Value
In this example, we are giving a program to find ASCII value for a given character. A character variable contains a value instead of that character itself in C Programming. This value is known as ASCII value.
Program to find the ASCII value:
#include <stdio.h>
int main()
{
char c;
printf("Enter a character: ");
scanf("%c", &c);
// %d shows the integer value for the character
// %c displays the actual character
printf("ASCII value of %c = %d", c, c);
return 0;
}
Output:
Enter a character: A ASCII value of A = 65