C Tokens - Study Notes
What is a Token?
A token in C is the smallest meaningful element of a C program.
Types of C Tokens
No. Token Type Description Examples
1 Keywords Reserved words in C int, float, return, if
2 Identifiers User-defined names main, sum, totalMarks
3 Constants Fixed values that do not change 10, 'A', 3.14
4 Strings Characters in double quotes "Hello", "C language"
5 Operators Symbols that perform operations +, -, *, ==, >=
6 Special Symbols Used in syntax/structure ;, {}, #, (), []
Example Program Showing Tokens:
#include <stdio.h> // Special symbol, keyword, string
int main() { // Keyword, identifier, special symbols
int num = 10; // Keyword, identifier, constant, operator
printf("Value: %d", num); // Identifier, string, special symbols
return 0; // Keyword, constant, special symbol
}