In C programming language, tokens are the smallest individual elements that are meaningful to the compiler. They are the basic components of a C program and can be classified into six types based on the functions they perform:
- Keywords
- Identifiers
- Constants
- Strings
- Special Symbols
- Operators
Keywords are pre-defined words in the C compiler that perform a specific function in a C program. Identifiers are variables that hold a value and store it in memory. Constants are fixed values that cannot be altered during program execution. Strings are a sequence of characters enclosed in double quotes. Special symbols are characters used in C programming that are not operators. Operators are symbols that perform specific mathematical or logical operations.
Each and every punctuation and word in a C program is a token, and a compiler breaks a C program into tokens and proceeds to the next stages used in the compilation process. Without tokens, it is impossible to create a C program.