What is Token in the C Programming Language

Programming

The smallest individual unit of program is known as a token in the C programming language.

The token is divided into six different parts

  • Keyword
  • Identifier
  • String
  • Constant
  • Special character
  • Operator
token

Keyword: reserve words in C language are known as a keyword. Every keyword has fix meaning and this meaning can not be changed. All keywords must be written in lower case.

There are 32 keywords are available in C programming language such as float, while, char, long, double, if, else, do, for, goto, break, continue, switch, case. All keywords display in white color in the editing window.

Identifier: it is also known as variables and generally uses to store the information e.g. int where a is a variable that stores the decimal value.

Example:

int a;

float b;

char c;

Constant: The value of the variable cannot be changed during the execution of a program is known as a constant.

Example:

int a=10;

char c=’x’;

String: it refers to collection of character or a single character. in c programming language we can define single character and string as follow.

Example:

char c=’x’;

char c[10]=”xyz”;

Special symbol: Symbol except digit whitespace letters are known as a special symbol or character.

Example:

{}, (), :, /,  &,

Operators: Operators are symbols that cause action when applied to C and other objects variables. The data items acted upon by operators are called operands.

Operators can be listed as follows, depending on the number of operands that an operator can operate upon:

Unary Operators: those operators that only need a single operand to function are known as unary operators.

Binary Operators: These operators are called binary operators, which require two operands to act upon. Binary operators are categorized into:

  • Assignment Operators
  • Conditional Operators
  • Arithmetic operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators

Ternary operators: Such operators are expected to operate on three operands. For example operator conditional(?:).