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

#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 refer to the ASCII Table article to understand the list of Codes and their Characters in 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.

ASCII Value of all Characters Example