Character Set of C Programming Language
This note is about the Character set of C programming Language. It defines the Variables, some data types and Declaration of Variables too.
Summary
This note is about the Character set of C programming Language. It defines the Variables, some data types and Declaration of Variables too.
Things to Remember
- The C character set consists of upper and lowercase alphabets, digits, special characters and white spaces. The alphabets and digits are altogether called as the alphanumeric character.
- A variable is an entity that has a value and is known to the program by name. The value of the variable changes during each execution the variable definition associated with memory location with the variable name.
- Precision refers to the number of significant digits after the decimal point. In another sense, it is the accuracy to a certain decimal number.
- A qualifier alters the characteristics of the data types such as size or sign. The qualifier that alters the size is short and long. They are applicable to the integers.
- Int, char, float, double, short int, long int, unsigned int, signed int, signed long int, unsigned long int are the example of data types used in C programming language.
MCQs
No MCQs found.
Subjective Questions
No subjective questions found.
Videos
No videos found.

Character Set of C Programming Language
Character Set

The C character set consists of upper and lowercase alphabets, digits, special characters and white spaces. The alphabets and digits are altogether called as the alphanumeric character.
- Alphabets
A B C D E F ………..Z
a b c d e f ………….z
- Digits
0 1 2 3 4 5 6 7 8 9
- Special Characters
, comma | . period | ; semicolon |
: colon | # number sign | ‘ apostrophe |
“ quotation mark | ! exclamation mark | | vertical bar (pipe) |
~ tilde | < opening angle bracket | > closing angle bracket |
_ under score | $ dollar sign | ( left parenthesis |
) right parenthesis | % percent sign | ? question mark |
& ampersand | ^ caret | * asterisk |
- minus | + plus sign | [ left bracket |
] right bracket | { left brace | } right brace |
/ slash | \backslash |
- White space characters
Blank space newline carriage return
Form feed horizontal tab vertical tab
Escape Sequence: The escape sequence is used in C programming language. The escape sequence helps in managing the programs. These are also known as backslash character constants
Character | Escape Sequence | ASCII Value |
bell (alert backspace horizontal tab the new line (line feed) vertical tab form feed carriage return a quotation mark (“) apostrophe (‘) a question mark (?) backslash (\b) null octal number hexadecimal number | \a \b \t \n \v \f \r \” \’ \? \\ \0 \o0 \xhh | 007 008 009 010 011 012 013 034 039 063 092 000 Eg., \5, \005, \123, \177 Eg., \x5,\x53, \x7f |
Identifiers and Keywords
Every word in C programming language is classified either as identifier or keyword. Identifiers are used to name the variables, symbolic constants, function, etc. Keywords are reserved words and they have predefined meanings and cannot be changed by the user. Identifier names have particular rules, such as:
- Identifier name must begin with a letter and must be a sequence of letters and digits.
- The underscore character (‘_’) is considered as the letter.
- All the keyword must be in small letters. They have reserved works and they cannot be treated as a variable in the program. They use specified syntax.
- The C language is case sensitive. For example, rate, Rate and RATE are treated as three different types of data.
- For any internal identifier name, at least 31 characters are significant.
The keywords are:
- Auto double int struct
- Break else long switch
- Case enum registers typedef
- Char extern return union
- Const float short unsigned
- Continue for signed-unsigned
- Default go to size of volatile
- Do if static while
Variables

A variable is an entity that has a value and is known to the program by name. The value of the variable changes during each execution. The variable definition associated with memory location is with the variable name. A variable can have only one value assigned to it in every time of execution of the program. Its value can change in different executions.
Example
F= 1.8 * c +32
The above example tells that f and c are the variables. Their values will be changed while the program executes.
Naming a Variable
Since, a variable has a name, let us give some example of valid variables.
I, rank, max, min, class_mark, stud_name,emp_no, Mark, StudName, etc. are valid variables names.
Here are some invalid variables names.
- Sun’s illegal character (‘)
- Fine doubled blank space not allowed
- 5square first character should be letter
- teacher, sal comma not allowed
The variable described above can be put into two categories, namely, globally variable and local variable. The variables defined before the main () are considered as the global variable and the variables within the function or program modules are local variables.
The global variable can be accessed from any subprogram or module or function whereas the local variables are confined within the same module or function.
Example:
#include <stdio.h> #include <conio.h> Int a; Void main() { Program codes } |
In the above example, int a is the declaration of a variable. The variable “an” is considered as a global variable which has effect throughout the program and it can be used anywhere in the program.
Same Data Types
The C language uses various data types. Some of the most important and common data types are listed below:
- Char a single byte that can hold one character
- Int an integer
- Float a single precision floating point number
- Double a double precision floating point number
Note: Precision refers to the number of significant digits after the decimal point. In another sense, it is the accuracy to a certain decimal number.
Qualifier
A qualifier alters the characteristics of the data types such as size or sign. The qualifier that alters the size is short and long. They are applicable to the integers.
Example of Size Qualifier
- Short int integer represented by a lesser number of bits (usually 16)
- Long int integer represented by a greater number of bits (usually 32)
- The qualifier long can be used along with the double precision floating point type.
- Long double an extended precision floating point number
Examples of Sign Qualifier
The sign qualifiers are signed and unsigned. The sign qualifiers combine the inter-data types (int, short int, and long int) resulting in six more type of data.
- signed chart int
- unsigned short int
- signed int
- unsigned int
- signed long int
- unsigned long int
- The sign qualifier can be used with the character also.
- signed char
- unsigned char
Note: The size qualifier short and long cannot be applied to the data types char and float, and sing qualifies signed and unsigned cannot be applied to float, double and long double.
The following table gives us the idea of the total numbers of bits and number range that can be used in all IBM PC.
Data Type | Bits Used | Range of Numbers |
int short int long int unsigned int unsigned short t int unsigned long int | 16 16 32 16 16 32 | -32, 768 to 32, 767 Same as above -2, 147, 483, 684, to 2, 147, 483, 647 0 to 65,535 0 to 65,535 0 to 4, 294, 967, 295 |
Declaration of Variables
The variables are necessarily defined before they are used. For this purpose, we use the following conventions.
data type v1,v2, …… vn;
Here, data type refers to the type of the data and v1,v2, etc.., respectively represent different data in single line.
Example: The following way declaring variables are more appropriate.
int count; int number, total; double ratio; int no=10; |
The last example, int no=10, represents the assignment of 10 to a variable no which is integer type of data. This is an assignment operation. Similarly, the other assignments are:
int filament =100;
char no = ‘x’;
double balance = 25. 28;
The process of giving the initial value to variables is called initialization. C allows the initialization of more than one variable in one statement using multiple assignment operators.
Example of Multiple Assignments
P = q = r = 0;
a = b =c = min;
Example of Assignments
Float x, p;
double y, q;
unsigned k;
Example of Declarations
int m = 5444;
long int n = 12345678;
Example of Assignments
x = 1.23456;
y = 9.887654;
k = 54321;
P = q = 100;
Example of Printing
printf(“\nm = %d”,m);
printf(“\nmn= ”,n);
printf(“\nx = %f”,x);
printf(“\ny = %2.12f”,y);
printf(“\nk = %u” p = %f q = % 1.21f”, k,p,q);
References:
Khanal, R.C. Khanal, R.C. Computer Concept for XII. Pashupatigriha Marga, Thapathali, Kathmandu, Nepal: Ekta Books Distributors Pvt. Ltd., 2010. 134-139.
Adhikari, Deepak Kumar.,et.al., Computer Science XII,Asia Publication Pvt.Ltd
Lesson
Programming in C
Subject
Computer Science
Grade
Grade 12
Recent Notes
No recent notes.
Related Notes
No related notes.