Home ProgrammingC Language Tokens In C Language.

Tokens In C Language.

by Log Raj Bhatt
0 comment 462 views

The smallest parts of program which are recognized as atomic unit by compiler during parsing are tokens. All a C program contain is bunch of tokens. Each and Individual words and punctuation marks are called tokens which are also called lexical units. Similarly, the smallest individual unit in a c program is known as a token or a lexical unit. C tokens can be of following types:

  1. Keywords
  2. Identifiers
  3. Operators
  4. Constants
  5. Special Symbols(punctuators)
  6. Strings

Every thing in a c program are tokens. Lets do anatomy of following code.

int fact(int n){
if(n <=1){
return 1;
else {
return n * fact(n-1);

  • int, if, else, return :- Keywords
  • fact, n :- Identifiers
  • (, {, ;, ), } :- symbol, punctuation
  • <=, *, – :- Operators
  • 1 :- Constant

In this way compiler recognize each token from a program.

0 comment

Related Articles

Leave a Reply

Do NOT follow this link or you will be banned from the site!