c++3(Token)

C++ Token

The Smallest individual unit of a program is knowm as token.
C++has following tokens:

  • keywords
  • identifiers
  • constant
  • strings
  • specal symbols
  • operations

Key Words and Identifiers

C++ reserve a set of 84 words forits own use.
The Words are called keywords (or reserve words), and each of these keywords has special meaning within the C++ language.
Identifiers are names that are given to various users defined program elements, such as variable, function and array.
Some of predefined identifers are cout, cin main.



You can't use keyword as identifier in your C++ programs, its reserved words in C++ library and used to perform an internal operation.
asm else new this
auto enum operator throw
bool explicit private true
break export protected try
case extern public typedef
catch false register typeid
char float reinterpret_cast typename
class for return union
const friend short unsighed
const_cast goto signed using
continue if sizeof virtual
defalt inline static void
delete int static_cast volatile
do long struck wchar_t
double mutable switch while
dynamic_cast namespace template
the following words are also reserved:

and bitor not_eq xor
and_eq compl or xor_eq
bitand not or_eq

Rules for naming identifiers in c++

First character must be alphabet or underscore.
It can contain only letters (a...z, A...Z), digits(0 to 9) or underscore.
Identifiers name cannot be key word.
Identifer can be as long as you like.

Constant/Literals

Constant in c++ refer to fixed values that do not change during execution of program.