Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What are tokens in the C language?


The individual elements of a program are called Tokens. In a C program, a number of individual units or elements occur. These elements are called C Tokens. In the C language, the following 6 types of tokens are available:

  1. Identifiers
  2. Keywords
  3. Constants
  4. Operators
  5. Special Characters
  6. Strings


Each program element in a C program is called an identifier. An identifier is a variable that holds a value and stores it in the memory.

Rules for declaring identifiers:

  1. The identifier should consist of alphabets from a to z and A to Z.
  2. It may contain numerical values from 0 to 9.
  3. It may contain the underscore value.
  4. The starting character of an identifier must always be a letter. Example: Variables, functions, labels, etc.


Keywords are words whose meaning has already been defined by the computer – they are pre-defined words in the C compiler. Each Keyword is meant to perform a specific function in a C program. Keywords are case sensitive and are written in lower case. The C language has 32 keywords, they are:


A constant is a fixed value that cannot be altered during the execution of a program. C Constants can be classified into two categories:

  1. Primary Constants
  2. Secondary Constants

Primary constant

A primary constant is, again, divided into these three types:

  1. Numeric
  2. Character
  3. Logical
  • Numeric is subdivided into two types, Integer and Float.
  • Character is subdivided into two types, Single Character and String


The secondary constant is divided into the following types:

  1. Arrays
  2. Structures
  3. Union
  4. Pointer
  5. Enum etc.


Operators are symbols that provide instructions for the performance of various mathematical and logical operations. Operators are tools that can alter data and variable values.

Operators are classified into the following eight types:

  1. Arithmetic Operators
  2. Relational Operators
  3. Logical Operators
  4. Increment/Decrement Operators
  5. Assignment Operator
  6. Bitwise Operators
  7. Conditional Operators
  8. Special Operators

Special characters

All the characters other than a to z, A to Z, and 0 to 9 are special characters. Example: {,},[,],(,)

A character data type consumes 8-bits of memory, which means that one can store anything in a character whose ASCII value lies between -127 and 127. Thus, it can hold any of the 256 different possible values.


A string is a group of characters that should be enclosed in double quotations.

For example: char string[]=“gitam”;


A variable is a user-defined word that, depending on the data type, will have some storage area. The variable’s value will be changed during the program execution, and the data type and its value will be changed during the program execution. The declaration of a variable is:

Datatype var1, var2, ...., varn;

Example: int a, float a, char x1;

Rules for variables

  1. A variable is a combination of letters and digits.
  2. The length of the variable is no more than 31 characters; however, the length is normally more than 8 characters.
  3. A variable should not be a reserved word.
  4. "Special symbols, except the underscore(_),are not allowed.
  5. The first character in a variable must be an alphabet.
  6. No commas or blank spaces are allowed within a variable.



View all Courses

Keep Exploring