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

Spread the love

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.

Related C Programs:

Learn more about ASCII :

Venkat

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...

9 Responses

  1. May 26, 2021

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

  2. May 26, 2021

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

  3. May 27, 2021

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

  4. May 29, 2021

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

  5. May 30, 2021

    […] 📢 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. May 31, 2021

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

  7. May 31, 2021

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

  8. June 1, 2021

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

  9. June 3, 2021

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

Leave a Reply