C Program to Print ASCII Value of all Characters

How to write a C Program to Print ASCII Value of all Characters with an example?. In C language, every character has its own ASCII value. Whenever we store a character, instead of storing the character itself, the ASCII value of that character will store. For example, the ASCII value for the A is 65.

C Program to Print ASCII Value of all Characters

This program will print the ASCII values of all the characters currently present.

/* C Program to print ASCII Value of all Characters */

#include <stdio.h>
 
int main()
{
  	int i;
  
  	for(i = 0; i <= 255; i++)
   	{
    	printf("The ASCII value of %c = %d\n", i, i);
   	}
  	return 0;
}

I suggest you to refer ASCII Table article to understand the list of ASCII Codes and their Characters in C Programming. As you know, the ASCII values of all the characters will be between 0 and 255. That’s why we used for loop to start at 0 and iterate the program loop up to 255.

C Program to print ASCII Value of all Characters Example