What is the character set?

In computing, the Character set is a defined list of characters recognized by the computer software and hardware. Here, each character is represented by a number. For example :-  A is represented by 65 and a is by 97.

Character Set in C Programming Langauge

Like all other languages, C has their own character set named as ASCII(American standard code for information interchange) Character set.

The character set contains digits, alphabet, white spaces, escape sequences and special symbols. These characters can be combined to make variables.

C uses variables, constants, keywords, expressions and operators as building blocks to form a C program. Each C program is a set of different statements and each statement is a set of different lexims. In computing, each and every character is considered as a single lexim.

There are 256 characters in the ASCII character set.

Valid C characters are listed below:

Alphabet or letters in C character set:

  • Uppercase letters  A to Z
  • Lower-case letters a to z

 alphabet or letters in c character set

Digits from 0 to 9

Digits from 0 to 9, character sets in c

Special Characters and escape sequence in C character set:

Special Characters

Non-alphabetic and non-numeric characters such as #, @,%,$ etc. are called special characters in computation.

Valid special characters are listed below:


Special Characters in C

 

Control Characters

The ASCII Character set reserves first 32 codes ( from 0 to 31) for control characters.

Let us understand, What are control characters?

In Computing, control character( non printing character) is a special character in character set , that does not print a written symbol. They have special purposes to do with cursor movement and are written into an ordinary string or a character by typing a backslash character ( \ ) followed by some other character.

The control characters  are generally  used in telecommunication for in-band signaling. These are used to control devices or provide meta information of data streams that are stored on magnetic tape.

Other than these 32 characters in the ASCII set, 95( from 32 to 127) characters are printable characters in ASCII character set except space( code 32).

Escape Sequence

It  is a sequence of characters that does not represent itself when used inside a String literal, but is translated into another character sequence that may be difficult or impossible to represent directly.

In C language, an Escape sequence consists of two characters the first one is backslash (/) and the other one will be a character or a digit which will determine interpretation of the sequence.

The Control Characters and escape sequences are listed below :

Control Characters and Escape Sequences

 

In the C language, we often used 128 characters ( from 0 to 127). Characters from 128 to 255 are called extended characters in ASCII character set.

How to print ASCII value through a C program:

#include <stdio.h>
int main()
 {  
    char value;
    printf("Enter a character: ");
    scanf("%c", &value);  

    // %c displays the actual character
    // %d displays the integer value of a character

    printf("ASCII value of %c = %d", value, value);
    
    return 0;
}

 

Note: C language does not use every character we found on a  keyboard.