- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Types
Tokens are classified into different types, which are mentioned below −
- Keywords
- Identifiers
- Constants
- Strings
- Special Symbols
- Operators
Example
Given below is the C program the use of identifiers, keywords, variables etc.
#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; }
Output
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.
Advertisements