Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Array

Patterns

Excersises


C Program to Find ASCII Value of a Character


In this program, we are getting a character as input from the user and find its ASCII value.

What is ASCII code?

ASCII stands for American Standard Code for Information Interchange.ASCII is a standard character encoding used in telecommunication.There are 256 ASCII characters. It is divided into three different categories as follows

  • 0-32 Non-Printable Characters.
  • 33 to 127 Printable Characters.
  • 128 to 255 Extended Characters.

Example : pgm.c

#include<stdio.h>
void main()
{
  char ch;

  printf("Enter the Character : ");
  scanf("%c",&ch);

   // %d displays the integer value of a character
  // %c displays the actual character
  printf("ASCII value of %c is %d",ch,ch);
}

Output:

Enter the Character : A
ASCII value of A is 65