The C Character Set

By: Nithya Suresh Emailed: 1786 times Printed: 2614 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

A character denotes any alphabet ,digit or symbols to represent information.The following are the valid alphabets, numbers and special symbols permitted in C 

Numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 

Alphabets: a, b, ….z

                  A, B, ……...Z 

Arithmetic Operations: +, -, *, /, %(Mod) 

Special Characters:


( ) { } [ ] < >
= ! $ ? . , : ;
& | ^ ~ ` #
\ blank - _ / * % @


A ‘constant’ is an entity that does not change, but a ‘variable’ as the name suggests may change. We do  a number of calculations in a computer and the computed values are stored in some memory spaces. Inorder to retrieve and re-use those values from the computer’s memory locations they are given names. Since the value stored in each location may change, the names given to these locations are called as ‘variable names’.


There are mainly three types of constants namely: integer, real and character constants.

Integer Constants:

The integer constants

  • Whole Numbers
  • Eg. 25, 35, -25, -46
  • Computer allocates only 2 bytes in memory.
  • 16th bit is sign bit. (if 0 then +ve value, if 1 then –ve value)


1       1       1       1        1       1       1      1       1        1       1        1       1       1        1

214        213       212         211        210        29         28      27      26        25          24           23         22           21           20 

= 1*1  +  4*1  +  8*1  +  16*1  +  32*1  +  64*1  + 128*1  +  256*1  +  512*1  +  1024*1  +  2048*1  +  4096*1  +  2*1  +  8192*1  +  16284*1 

=  32767 (32767 Bits can be stored for integer constants)

  • 32768 is negative
  • -32767 is minimum

       (i) Decimal Integer Constant:

  • 0 to 9
  • E.g: 49, 58, -62, … (40000 cannot come bcoz it is > 32767)

        (ii) Octal Integer Constant:

  • 0 to 7
  • Add “0” before the value.
  • Eg.: 045, 056, 067

        (iii) Hexadecimal Integer:

  • 0 to 9 and A to F
  • Add 0x before the value
  • E.g: 0x42, 0x56, 0x67


The real or floating point constants are in two forms namely fractional form and the exponential form.

A real constant in fractional form must:

  • Have at least one digit
  • It must have a decimal point
  • Could have positive or negative sign(default sign is positive)
  • Must not have commas or spaces within it
  • Allots 4 bytes in memory

Ex:  +867.9, -26.9876, 654.0 

In exponential form, the real constant is represented as two parts. The part lying before the ‘e’ is the ‘mantissa’, and the one following ‘e’ is the ‘exponent’.

The real constant in exponential form must follow the following rules:

  • The mantissa part and the exponential part should be separated by the letter ‘e’
  • The mantissa may have a positive or negative sign(default sign is positive)
  • The exponent must have at least one digit
  • The exponent must be a positive or negative integer(default sign is positive)
  • The range of real constants in exponential form is -3.4e38 and -3.4e38

Ex:  +3.2e-4,  4.1e8,  -0.2e+4,  -3.2e-4 


A character constant is an alphabet, a single digit or a single special symbol enclosed within inverted commas. The maximum length of a character constant can be 1 character. Allots 1 byte of memory

Ex:  ’B’,  ’l’,    ’#’ 

Types of C Variables

Variable names are names given to locations in the memory. These locations can contain integer, real or character constants. An integer variable can hold only an integer constant, a real variable can hold only a real constant and a character variable can hold only a character constant.  

Rules for Constructing Variable Names

A variable name is any combination of 1 to 31 alphabets, digits or underscores. Some compilers allow variable names whose length could be up to 247 characters.

  • The first character in the variable name must be an alphabet
  • No commas or blanks are allowed within a variable name.
  • No special symbol other than an underscore (as in net_sal) can be used in a variable name.

Ex.: si_int



C compiler makes it compulsory for the user to declare the type of any variable name that he wishes to use in a program. This type declaration is done at the beginning of the program. Following are the examples of type declaration statements:

Ex.: int si, e_hra ;

float bas_sal ;

char code ;

Since, the maximum allowable length of a variable name is 31 characters, an enormous number of variable names can be constructed using the above-mentioned rules. It is a good practice to exploit this enormous choice in naming variables by using meaningful variable names.  

C Keywords

C makes use of only 32 keywords or reserved words which combine with the formal syntax to the form the C programming language. Note that all keywords in C are written in lower case. A keyword may not be used as a variable name.

































C Home | All C Tutorials | Latest C Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


1. View Comment


View Tutorial          By: sandesh at 2009-10-01 01:15:29
2. View Comment


View Tutorial          By: Jaleel at 2009-10-16 23:22:52
3. View Comment

excellent..... thanks it help me a lot.......

View Tutorial          By: REJAPUTRA at 2009-10-23 09:19:25
4. View Comment

very nice

View Tutorial          By: prasad at 2009-11-11 05:03:16
5. View Comment

excellent to easy going

View Tutorial          By: murali at 2009-11-15 23:13:21
6. View Comment

keep it up!

View Tutorial          By: kamran at 2010-04-13 07:01:26
7. View Comment

very nice thank you so much my dude

View Tutorial          By: mohd at 2010-07-28 02:40:23
8. View Comment

good but you don't express the programs examples

View Tutorial          By: anchal at 2010-09-29 02:40:02
9. View Comment

thanx.thats a useful material for the students, intersted to study about C.

View Tutorial          By: MUHAMMAD ABUBAKAR YASEEN at 2010-10-28 04:19:00
10. View Comment

It is very useful.thank you so much.

View Tutorial          By: Pratiksha ijagaj at 2010-11-27 07:03:52
11. View Comment

easy to understand and it helped me a lot in preparing for my exams............... thanks a lot ...........

View Tutorial          By: shandini at 2011-04-14 13:14:33
12. View Comment


View Tutorial          By: shamim at 2011-07-08 02:39:31
13. View Comment

excellent...... thank you so much.

View Tutorial          By: balaji at 2011-07-19 07:56:08
14. View Comment

super excellent

View Tutorial          By: mani at 2013-05-27 05:32:06
15. View Comment

It is very useful ....Thank U sooo much dear...

View Tutorial          By: Augustine Francis at 2014-06-24 16:55:21

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by Nithya Suresh
The C Character Set

More Tutorials in C
Sum of the elements of an array in C
Printing a simple histogram in C
Sorting an integer array in C
Find square and square root for a given number in C
Simple arithmetic calculations in C
Command-line arguments in C
Calculator in C
Passing double value to a function in C
Passing pointer to a function in C
Infix to Prefix And Postfix in C
while, do while and for loops in C
Unicode and UTF-8 in C
Formatting with printf in C
if, if...else and switch statements in C with samples
Statements in C

More Latest News
Most Viewed Articles (in C )
Using memset(), memcpy(), and memmove() in C
Find square and square root for a given number in C
UNIX read and write system calls sample program in C
Open, Creat, Close, Unlink system calls sample program in C
lseek() sample program in C
Printing a simple histogram in C
assert() Function Example program in C
perror() Function - example program in C
Listing Files and Directories sample program in C
Using free() Function in C
Formatting with printf in C
goto and labels in C
Character Arrays in C
Using realloc() Function in C
Sum of the elements of an array in C
Most Emailed Articles (in C)
Declarations in C
else if statement in C
ERRNO.H Header File in C
Using the qsort() and bsearch() functions with values - example program in C
The for statement in C
Arguments - Call by Value in C
Variable Scope and functions in C
typedef example program in C
Listing Files and Directories sample program in C
perror() Function - example program in C
Using qsort() and bsearch() with strings - example program in C
Statements in C
while, do while and for loops in C
Find square and square root for a given number in C
File Copying in C