What are the tokens in C ?

A token is nothing but a smallest element of a program which is meaningful to the compiler. The compiler that breaks a program into the smallest units is called tokens and these tokens proceed to the different stages of the compilation.


Tokens are classified into different types, which are mentioned below −

  • Keywords
  • Identifiers
  • Constants
  • Strings
  • Special Symbols
  • Operators


Given below is the C program the use of identifiers, keywords, variables etc.

 Live Demo

#include <stdio.h>
int main(){
   int a,b,c;
   printf("enter a and b values: 
");    scanf("%d%d",&a,&b);    c=a*b;    printf("value of c=%d",c);    return 0; }


When the above program is executed, it produces the following result −

enter a and b values:4 5
value of c=20

In the above program,

  • main is the identifier.
  • int is the keyword.
  • { } are the delimiters.
  • a,b,c are the variables.

All together are called as tokens.

Updated on: 03-Sep-2021


Kickstart Your Career

Get certified by completing the course

Get Started