What is keyword, Identifiers and Tokens in C++?

Tokens

The smallest individual units in a program are known as tokens.

C++ has

  • Keywords
  • Indentifiers
  • Constants
  • Strings
  • Operators

C++ Program is written using these tokens, white spaces, and the syntax of the language.

Keywords

They are explicitly reserved identifires and cannot be used as names for the program variables or other user defined program elements.

Example: break, while, case, switch etc

Identifiers 

Identifiers refers to the names of variables, functions, arrays, classes etc. created by the programmer.They are fundamental requirement of the langugage.

There are following rules for creating the identifiers

  1. Only alphabates , digits and undersocre (_) are permitted.
  2. Name can’t be start with thr digit.
  3. Upper and lower case are different.
  4. A declared keyword can’t be used as a variable.

Leave a Reply