top of page

ASCII Conversion

An ASCII character is a code for representing letters with numbers. These may be hexadecimal numbers, binary numbers, octal numbers, and soforth. Generally coders will be working with decimal numbers, the normal numbering system we use daily. Each letter in the alphabet along with some symbols and has an assigned decimal number to it.

The standard list of printable ASCII characters range from the decimal value 32 to 126.

asciiconversion1.png

So, if a character is really just a decimal number we can print characters from these integer values. Try making an integer equal to 65 then printing it using the %c conversion character with printf.

Example:

Output:

asciiconversion3.png
asciiconversion2.png

As expected we get the character value equal to the value we inserted as an integer.

We can also set an integer value equal to a character and it will automatically set the integer equal to the decimal equivalent of the character.

Example:

Output:

asciiconversion5.png
asciiconversion4.png

While it may not be necessary to remember the entire ASCII table it is helpful to remember that capital 'A' starts at decimal number 65 and lowercase 'a' starts at decimal equivalent 97.

PS: Here's a really simple little script to generate the printable contents of the ASCII table.

asciiconversion6.png
  • Twitter
  • LinkedIn
  • discord-logo--v2
  • kisspng-github-pages-logo-repository-fork-github-logo-1-magentys-5b69de71b51265

Dragon Eye Intelligence LLC

bottom of page