The C program is a collection of instructions and each instruction is a collection of individual units.
Every small individual unit of a C program is generally called as token and every instruction in a C program is a collection of tokens.
Tokens are used to construct the C programs and they are also said to be the basic building blocks of a C program.
In a C program, tokens contain the following −
- Keywords
- Identifiers
- Operators
- Special Symbols
- Constants
- Strings
- Data values
In a C program, a collection of all these keywords, identifiers, operators, special symbols, constants, strings, and data values are called tokens.
Example
Following is the C program to print the capital alphabet characters −
#include<stdio.h> #include<conio.h> int main(){ int i; printf("ASCII ==> Character\n"); for(i = 65; i <= 90; i++) printf("%d ==> %c\n", i, i); return 0; }
Output
When the above program is executed, it produces the following result −
ASCII ==> alphabet Character 65 ==> A 66 ==> B 67 ==> C 68 ==> D 69 ==> E 70 ==> F 71 ==> G 72 ==> H 73 ==> I 74 ==> J 75 ==> K 76 ==> L 77 ==> M 78 ==> N 79 ==> O 80 ==> P 81 ==> Q 82 ==> R 83 ==> S 84 ==> T 85 ==> U 86 ==> V 87 ==> W 88 ==> X 89 ==> Y 90 ==> Z