C Program to Print ASCII Value of all Characters

How to write a C Program to Print the 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 be stored. For example, the ASCII value for the A is 65.

This below mentioned 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 C Programming. As you know, the ASCII values of all the characters will be between 0 and 255. That’s why we used C for loop to start at 0 and iterate the C program loop up to 255.

C Program to Print the ASCII Value of all Characters

Also Read