C ASCII Code
#include
<stdio.h>
int main()
{
char
chr;
printf("Enter a character: ");
scanf("%c",&chr);
//
When %c text format is used, character is displayed in case of character types
printf("You entered %c.\n",chr);
//
When %d text format is used, integer is displayed in case of character types
printf("ASCII value of %c is
%d.", chr, chr);
return
0;
}
By adding // we can denote a comment in C.
In the above example i have described the code inside of it by using comments.
The output of the above code |
Comments
Post a Comment