Tuesday 25 February 2014

How to get the ASCII value of a character in c

How to get the ASCII value of a character in c
#include<stdio.h>
int main(){
 
    char c;
    printf("Enter any character: ");
    scanf("%c",&c);
    printf("ASCII value of given character: %d",c);
       
    return 0;
}
Sample output:
Enter any character: a
ASCII value of given character: 97

No comments:

Post a Comment