Wednesday, March 20, 2013

Program to calculate ACSII value of characters, digits and symbols

Most of character and string operations are based on ASCII values.
ASCII value is standard value for every character, digit and symbol in C compiler.
There are 128 ASCII values but Extended ASCII can represent 256 characters.

A Complete ASCII Table:


A really long chart, hmmm !!
Don't worry you don't need to remember these all values. You can find common ASCII values using a simple logic. What you need to do is -

  • Take a character variable to get user input.
  • Then print that character variable with %d format specifier.
  • It will print ASCII value of that character.
Note: Generally %c format specifier is used with character variable to scan it and print it, but if we use %d to print it, then it will print ASCII value.

A simple program which takes a character input and prints its ASCII  and reduces the burden of remembering all these values :-

Powered by Blogger.