C Program To Find The ASCII Value Of A Character

C Program To Find The ASCII Value Of A Character

ASCII (American Standard Code for Information Interchange), also known as ASCII code, is actually a numerical representation of any character.

Each character, such as letters, numbers, digits, or symbols, has a 7-bit binary code that varies from 0 to 127.

It is easy for the computer to understand any character through ASCII values.

In this blog post, I will teach you to write code in C Programming, through which you can find out the ASCII value of any character very easily.

C Program To Find The ASCII Value Of A Character

/*C Program To Find The ASCII Value Of A Character*/
#include <stdio.h>

int main() {
    char character;

    // Input from the user
    printf("Enter a character: ");
    scanf("%c", &character);

    // Finding and printing the ASCII value
    int asciiValue = (int)character;
    printf("The ASCII value of '%c' is: %d\n", character, asciiValue);

    return 0;
}

Summary

If you want to learn similar programming questions and concepts in an easy language, then you can explore our site, where you will find a lot of content.

Similar articles

About The Author

Leave a reply

Your email address will not be published. Required fields are marked *