Friday, August 14, 2026
Home Academic Everything about ASCII in C

Everything about ASCII in C

American Standard Code for Information Interchange(ASCII) is a standard of character encoding for electronic communication. ASCII codes are universally used as a way to represent text in computers, networking equipment, and other various types of devices like IoTs and HHDs, etc. 

Usually, ASCII codes are written in 8 bits binary notations in case of binary arithmetics to represent different characters including upper case and lowercase alphabets as well as special symbols.

To print the ASCII Code in C Programming language, you can use different ways.

  • Take a character from the user and print ASCII of it.
  • Print all ASCII values
  • Print ASCII values between some range.

1. Get Character from the user and print ASCII Value of that character

#include<stdio.h>
void main()
{
    int e;
    char character;
    clrscr();
    printf("\n Enter a character of your choice: ");
    scanf("%c",&character);
    e=character;
    printf("\n The ASCII value of the character you've entered is : %d",e);
    getch();
}

One thing you should always consider while playing with ASCII is that the ASCII values of all the characters will be between 0 and 255. That’s why we need to use a loop starting at 0 and iterating up to 255 to print all characters in range 0 to 255.

For example, the following is the ASCII Table that shows ASCII of different characters and their equivalent values in a different number systems.

Image Source: https://www.kindpng.com/

Below is a table for non-printable ASCII Characters.

Image Source: https://www.fpds.gov/

2. To print ASCII of all characters and symbols

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


At the point when value of e is 65, it will print
The ASCII value of A = 65

3. To Print ASCII of characters in the range, one shall go with the following idea.

#include <stdio.h>
void main()
{
  int e;
  for(e = 65; e <= 90; i++){
    printf("The ASCII value of %c = %d\n", e, e);
   }
  getch();	
}

To print UPPER CASE english alphabets.
#include <stdio.h>
void main()
{
  int e;
  for(e = 97; e <= 122; i++){
    printf("The ASCII value of %c = %d\n", e, e);
   }
  getch();	
}



To print lower case english alphabets.

Thanks for being with me up to this point. Please share if you’ve found this article interesting.

datasagarhttp://www.DataSagar.com
Sagar is multidisciplinary technologist, educator, and entrepreneur based in Nepal. As the founder of Illionso Technologies and Kashi Garden Resort, he operates at the intersection of web architecture, data intelligence, innovation, and digital transformation. From building digital solutions to scaling real-world concepts, his mission is to share knowledge alongside merge emerging as well as disruptive technologies with transformative offline experiences.
RELATED ARTICLES

Why Linux Won the Infrastructure War? Lessons from Linus Torvalds

In 1991, 21-year-old Linus Torvalds announced a "hobby" operating system. Today, Linux powers supercomputers, cloud servers, and Android. Explore his journey, the open-source economy, and the lessons for modern developers.

What Is Vibe Coding? A Complete Beginner’s Guide to Building Software and Web Pages With AI

A few years ago, building a website meant sitting down with a programming book, picking a language, and slowly working through syntax...

What is Answer Engine Optimization (AEO)? Getting Ready for AI Powered Search and Agentic Era Digital Marketing

Search is changing faster than it has in the last two decades. For years, businesses focused on ranking their websites on search...

Most Popular

Why Linux Won the Infrastructure War? Lessons from Linus Torvalds

In 1991, 21-year-old Linus Torvalds announced a "hobby" operating system. Today, Linux powers supercomputers, cloud servers, and Android. Explore his journey, the open-source economy, and the lessons for modern developers.

What Is Vibe Coding? A Complete Beginner’s Guide to Building Software and Web Pages With AI

A few years ago, building a website meant sitting down with a programming book, picking a language, and slowly working through syntax...

What is Answer Engine Optimization (AEO)? Getting Ready for AI Powered Search and Agentic Era Digital Marketing

Search is changing faster than it has in the last two decades. For years, businesses focused on ranking their websites on search...

The Plain Text Web: Why llms.txt Is Becoming the New Site Standard

The web built today is heavy. Between client-side JavaScript, cookie banners, tracker scripts, and responsive CSS grids, a typical webpage carries megabytes...