C program to print all ASCII characters and ASCII values/numbers

print-all-ascii-characters-and-ascii-values-numbers

Problem Description:

Write a Program to print all ASCII characters and their ASCII numbers

Examples:

Our task to print all ASCII characters with their ASCII number

Here are few ASCII Characters and their ASCII numbers.

  • For ASCII character Space the ASCII value is 32
  • character ‘A’ (Capital A) the ASCII value is 65
  • For ‘a’ (small a ) the ASCII value is 97
  • For 0 (zero) the ASCII value is 48

What is ASCII Number:

ASCII stands for American Standard Code for Information Interchange. It is a character encoding format.

The characters are not directly stored into the memory, We use the encoding to store in efficient way.

ASCII one of the encoding formats. There are other encoding standards such as Unicode (UTF-8, UTF-16, UTF-32) and etc.

ASCII standards contains 255 characters. We are going try to print all these 255 characters ASCII Characters with their Numbers.

But only 127 ASCII characters are printable characters. To be exact the printable ASCII Characters from number 32 which is space to number 126 which is ESC. So our output might gives undefined values after 127 characters.

Program Logic:

As we know we have 255 ASCII characters. We are going to for loop iterate 255 times.

The basic idea is to pass the integer value to printf function and use the character format specifier ( %c ). So the printf function will cast the integer to ASCII character. and prints the output to the console.

We are going to repeat the above process for all ASCII number from 0 to 255. At each iteration will make use of integer to character typecasting to print ASCII characters.

Print all ASCII characters and ASCII numbers Program:

Print ASCII values Output:

All ASCII Characters with Respective ASCII Numbers. Please note few characters are not printable.

print-all-ascii-characters-and-ascii-values-numbers-output

Related C Programs:

Learn more about ASCII :

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

15 Responses

  1. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  2. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  3. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  4. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  5. […] 📢 We have discussed all characters and their ASCII values in this post. C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  6. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  7. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  8. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  9. […] C program to print all ASCII characters and ASCII values/numbers – SillyCodes […]

  10. […] C Program to Print All ASCII Charcters and ASCII Values […]

  11. […] C Program to Print All ASCII Charcters and ASCII Values […]

  12. […] NULL Character( ) is a special character and its ASCII Value is equal to […]

  13. […] Related: List of ASCII characters with it’s values […]

  14. […] Here is the List of ASCII Characters with ASCII Values […]

  15. […] List of ASCII Characters with the ASCII Values in C […]

Leave a Reply