Tokens in C are the fundamental units of a C program, classified into six categories: identifiers, keywords, constants, strings, special symbols, and operators. Identifiers are names assigned to entities, keywords have predefined meanings, constants have fixed values, strings are character sequences, special symbols have specific meanings, and operators represent operations. Understanding token types is vital for writing syntactically correct and meaningful C programs.
Tokens in C is broadly divided into 6 categories such as:

Table of Contents
Identifiers:
- Identifiers refer to the names of the variables, functions, and erase. These are user-defined names. We can use uppercase and lowercase to define identifiers.
The rules for defining identifiers are:
- Identifiers should be formed with letters, digits, and underscore symbols.
- The first character of an identifier should be a letter or underscore.
- Each identifier should be unique.
- No special symbols/blank spaces are used in identifiers.
- Keywords must not be used as identifiers.
Examples: Sum, a12, -xyz.
Keywords:
- Every C word is either a Keyword or an identifier. All keywords will have fixed meanings and the user cannot change them. Keywords are the basic building blocks for program statements. All the Keywords must be written in lowercase letters only. There are 32 Keywords. In C-99 there are 37 keywords.
- The keywords are auto, break, case, char, const, continue, default, do, double, else, eenum, extern, float, for, goto, if, int, long, register, return, short, size of, signed, static, struct, switch, typedef, union, unsigned, void, volatile, while.
- The other five reserve words are
- bool, complex, imaginary, inline, and restrict.
Constants:
- A Constant is a fixed value that does not change the value during the execution of a program.
- C supports several constants.
- Constants are classified into numeric constants and character constants.
- Numeric constants are further classified into integer and real constants. Character constants are further classified into single and string constants.
- Integer Constant: An integer constant refers to a sequence of digits.
- Ex: 23, +37, -49, 0
Real Constant:

- Integer numbers are inadequate to represent quantities that vary continuously such as distances, height, temperatures, prices, etc… These quantities are represented by numbers containing fractional parts. A constant that has fractional parts is called real constants. It is also called floating-point constants.
- Ex: 0.0083, -0.75, 453.39+247.0
- We can also specify the floating-point constants as 213., -0.95, -0.43+0.52.
- A real number may also be expressed in scientific notation. The general form is mantissa e exponent
- Mantissa is real or integer. But the exponent is always an integer number. The mantissa part and exponent part are separated by the letter ‘e’.
- Ex: 0.65e4, 12e-2, 1.5e+5, 3.18e3, -1.2e-1
Single Character Constant:
- A single-character constant contains a single character enclosed within a pair of single quotation marks.
- ‘A’, ‘2’, ‘+’, ‘e’
- String Constant: A string constant is a sequence of characters enclosed in double-quotes. The characters may be letters, numbers, special characters, and blank spaces.
- Ex: “Dhoni”, “Virat Kohli”, “abc9”
Special Symbols:
- The special symbols are (), {}, ‘,’.
Variable:
- A variable is a data name which is used to hold a particular value. The value of the variable may change during the execution of a program.
- Declaration of the Variables:
- Before using the variables in the program, we have to declare the variables. The variables can be declared locally or globally. Declaration of variables does two things.
- It tells the compiler what the name of the variable is.
- It tells the compiler what type of data to be stored in the variable.
The syntax of declaring a variable in data type
var1, var2, ….., var n;
Ex: Int a, b, c;
char y;
Initialization of the variables:
We can also initialize the variables at the time of declaration.
Ex: Int a=5, b=7, c=9;
float a=45.65, b=94.32;
character y=’A’;
Write a programme to convert the temperature from Celsius to Fahrenheit.
#include<stdio.h> int main() { // Declare variables float celsius, fahrenheit; // Get the temperature in Celsius from the user printf("Enter the temperature in Celsius: "); scanf("%f", &celsius); // Convert Celsius to Fahrenheit fahrenheit = (celsius * 9 / 5) + 32; // Print the temperature in Fahrenheit printf("The temperature in Fahrenheit is: %.2f\n", fahrenheit); return 0; }
Output:
Enter the temperature in Celsius: 90
The temperature in Fahrenheit is: 194.00
FAQs related to the Topic
What are tokens in C programming?
Tokens in C programming are the smallest individual units that make up a C program. They are broadly classified into six categories: identifiers, keywords, constants, strings, special symbols, and operators.
What are the different types of tokens in C programming?
The different types of tokens in C programming are:
Identifiers: Names given to variables, functions, and other user-defined entities.
Keywords: Reserved words with predefined meanings that cannot be used as identifiers.
Constants: Fixed values that cannot be changed during program execution.
Strings: Sequences of characters enclosed in double quotes.
Special symbols: Characters with specific meanings in C, such as parentheses, braces, and semicolons.
Operators: Symbols that represent operations that can be performed on operands.What are the different types of constants in C programming?
The different types of constants in C programming are:
Numeric constants: Integer and real constants.
Character constants: Single character and string constants.What are the different types of operators in C programming?
The different types of operators in C programming are:
Arithmetic operators: +, -, *, /, and %
Relational operators: <, >, <=, >=, ==, and !=
Logical operators: &&, ||, and !
Assignment operators: =, +=, -=, *=, /=, and %=
Increment and decrement operators: ++ and —
Conditional operators: ? and :
Bitwise operators: &, |, ^, ~, <<, and >>