Understanding of Tokens in C Language
A token in the C programming language can be defined as the smallest individual element that holds meaning for the
compiler. It serves as the fundamental building block of a C program. C Language tokens are fundamental elements in programming, as they represent the building blocks of code.Types of Tokens in C Language
C language tokens can be categorized into six types based on their functions:

Keywords in C Language
Keywords in C are predefined or reserved words that have specific functions within a program. These words are reserved for compiler use and cannot be used as variable names since doing so would attempt to assign a new meaning to the keyword, which is not allowed. Keywords cannot be redefined, but you can specify text substitutions for keywords before compilation using C preprocessor directives. C language supports 32 keywords, including:
- auto
- double
- int
- struct
- break
- else
- long
- switch
- and more.
Identifiers in C Language
Identifiers are used to name variables, functions, and arrays in C. These names are user-defined and can consist of a sequence of letters and digits, starting with either a letter or an underscore (_). Identifiers must differ in spelling and case from keywords, and keywords cannot be used as identifiers. Once declared, an identifier can be used in subsequent program statements to refer to the associated value. A special identifier called a statement label can be used in goto statements.
Rules for Naming Identifiers:
- Must begin with a letter or underscore (_).
- Can consist of only letters, digits, or underscores.
- Cannot be a keyword.
- Must not contain white spaces.
- Limited to 31 characters in length, with only the first 31 characters being significant. Identifiers are case-sensitive.
Constants in C Language
Constants in C refer to variables with fixed values that cannot be modified once defined in the program. Constants can belong to any data type.
Examples of Constants in C:
- const int c_var = 20;
- const int* const ptr = &c_var;
Strings in C Language
Strings in C are arrays of characters terminated by a null character (‘\0’). The null character signifies the end of the string. Strings are enclosed in double quotes, while individual characters are enclosed in single quotes in C and C++.
Examples of Strings:
- char string[20] = {‘g’, ‘e’, ‘e’, ‘k’, ‘s’, ‘f’, ‘o’, ‘r’, ‘g’, ‘e’, ‘e’, ‘k’, ‘s’, ‘\0’};
- char string[20] = “geeksforgeeks”;
- char string[] = “geeksforgeeks”;
Special Symbols in C Language
Special symbols in C have unique meanings and cannot be repurposed for other functions. Some common special symbols include:
- Brackets [] for array element references.
- Parentheses () for function calls and parameters.
- Braces {} to delineate blocks of code.
- Comma (,) to separate multiple statements.
- Colon (:) for initialization lists.
- Semicolon (;) to terminate statements.
- Asterisk (*) for pointer creation and multiplication.
- Assignment operator (=) for value assignment and logical operations.
- Preprocessor (#) used for macro processing before compilation.
- Period (.) to access structure or union members.
- Tilde (~) used as a destructor to free memory.
Operators in C Language
Operators in C are symbols that perform actions on C variables and objects. Operators are categorized based on the number of operands they require:
- Unary Operators: Operate on a single operand (e.g., increment and decrement operators).
- Binary Operators: Require two operands (e.g., arithmetic, relational, logical, assignment, bitwise operators).
- Ternary Operator: Requires three operands and is often referred to as the conditional operator (?).
These tokens collectively form the foundation of the C programming language, enabling the creation of complex programs.