You cannot copy content of this page

C Tokens

C Tokens

C Tokens are the basic building block of C language which are constructed together to write a program.

Tokens in c language are of seven types:

  1. Delimiter
  2. Keywords
  3. Constants
  4. Identifiers
  5. Special symbols
  6. Operators


A delimiter is a unique character or a sequence of characters which signify beginning or ending of a specific statement,string or a function body.


: ColonUseful for label
; SemicolonTerminate the statement
( ) ParenthesisUsed in expression and function
[ ] Square bracketsUsed for array decleration
{ } Curly bracesScope of the statement or Block of a function
# HashPre-processor directive
, CommaVariables separator



Keywords are the predefined,reserved words in C library used in programming which have special meanings to compiler.

Keywords can not be used as name of any constant,variable or any other identifiers name.

There are 32 keywords in C language.



3.Constant or Literals:

A constant is any information or a data which have fixed value.Value do not change during the execution of program.

Types of constant :

3.1.Primary constant are of two types.

3.1.1.Numerical constant  are of two types. constant

It include all positive and negative number including zero.Exclude any decimal,fractional part or any other symbol.


+21  ,  23  , -5  ,  0    (these are integer constant)

+3.14  ,  23/34  ,  -7.23  ,  4.4*5.1      (these are not integer constant) constant or Float point constant :

Numbers containing decimals or we can say that a fractional part is present.

Examples:   2.5 , 4.453  ,  -2.34  , 2.0 (here 2.0 is not equal to 2 because of American Standard Code for  Information Interchange)etc


3.1.2.Character constant are of three types. Character Constants: 

It contains a single character(we can also say that a single digit, a single alphabets)   enclosed with ‘  ‘  (single quotes).

Example:  ‘  ‘ (single space is also character),  ‘a’  ,  ‘B’   , ‘9’ , ‘+’ etc  (these are real constant)

but  ‘4.0’  ,  ‘-3’   , ‘droid’  etc  (these are not real constant). Constants:

Strings are the group of characters enclosed in ”  ”  (double quotes).

Examples:  “droid”  ,  “4+2”  , “345” etc Character Constants or Escape sequences:

Backslash character constant have special meanings to compiler.List is given below.

\a007beep sound
\f012form feed
\n010new line
\r013carriage return
\t009horizontal tab
\v011vertical tab
\’039single quote
\”034double quote
\?063question mark


3.2.Secondary constant are of six types.


3.2.2.String :







Are the names of variables , functions , arrays.They are user defined names.

Rules for naming identifiers:

  1. Identifiers consist of alphabets and digits (A-Z , a-z , 0-9 ) and underscore (_) symbol.
  2. Identifiers first name must start with alphabet or underscore.
  3. Must not contains white spaces.
  4. First letter can not be a digit.
  5. Keywords names can not be used as identifiers name.
  6. Identifiers are case sensitive.(Which means droid is different from Droid or DROID).


5.Special symbols:


Quotation mark<less than
!Exclamation mark>Greater than
|Vertical bar( )Pranthesis
/Slash[ ]Square brackets
?Question mark=Equal to
_Underscore@At the rate


6.Operators :

If multiple operators present in statement then we use precedence(priority) rule.Here in C language there is predefined priority rule for operators called operator precedence.

If there are many operator of same priority present then we use associativity.

Associativity shows the order in which they executed.

( )
[ ]

++ —
Parentheses (function call)
Brackets (array subscript)
Member selection via object name
Member selection via pointer
Postfix increment/decrement
++ —
+ –
! ~
Prefix increment/decrement
Unary plus/minus
Logical negation/bitwise complement
Cast (convert value to temporary value of type)
Address (of operand)
Determine size in bytes on this implementation
*  /  %Multiplication/division/modulusleft-to-right
+  –Addition/subtractionleft-to-right
<<  >>Bitwise shift left, Bitwise shift rightleft-to-right
<  <=
>  >=
Relational less than/less than or equal to
Relational greater than/greater than or equal to
==  !=Relational is equal to/is not equal toleft-to-right
&Bitwise ANDleft-to-right
^Bitwise exclusive ORleft-to-right
|Bitwise inclusive ORleft-to-right
&&Logical ANDleft-to-right
| |Logical ORleft-to-right
? :Ternary conditionalright-to-left
+=  -=
*=  /=
%=  &=
^=  |=
<<=  >>=
Addition/subtraction assignment
Multiplication/division assignment
Modulus/bitwise AND assignment
Bitwise exclusive/inclusive OR assignment
Bitwise shift left/right assignment


Comma (separate expressions)left-to-right

Note 1:
Parentheses are also used to group sub-expressions to force a different precedence; such parenthetical expressions can be nested and are evaluated from inner to outer.

Note 2:
Postfix increment/decrement have high precedence, but the actual increment or decrement of the operand is delayed (to be accomplished sometime before the statement completes execution).

So in the statement y = x * z++; the current value of  z is used to evaluate the expression.


z++ evaluates to z and z only incremented after all else is done.

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!
Free Web Hosting