How to get the ASCII value of a character in c language | CTechnotips

Code to find the ASCII values of given character in c programming language:
#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

0 comments:

Post a Comment