ASCII value in C language
What is ASCII code?
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.
Each character or a special character is represented by some ASCII code, and each ascii code occupies 7 bits in memory.
Fig: ASCII Code In C Langauge |
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.
The ascii value of 'A' is 65.
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.
#include <stdio.h>
int main()
{
char c;
printf("Enter a character");
scanf("%c",&c);
printf("\n The ascii value of the c variable is %c = %d", c, c);
return 0;
}
Output:
Enter a character G
The ascii value of the c variable is 71
No comments:
Post a Comment