Token in C Plus Plus

The smallest units in a program is called token.
C++ has following tokens
 
  1. Identifiers
  2. Keywords
  3. Constants
  4. Strings
  5. Operators
 

Identifiers

Names of variable, functions, arrays, classes etc is called identifiers.
 
Example
int first_number;
int marks[5];
class Home{

}
void msg();
 

Keywords

These are reserved identifiers, and has fix value and information and can not be used as identifier to create variable, function etc.
 
C++ has following popular keywords.
  1. auto
  2. break
  3. continue
  4. class
  5. const
  6. default
  7. do
  8. while
  9. for, etc.
 

Constants

Any value declared with the keyword const, can not be modified by the program.
Example
const int age=20;
 

Strings

Collection of character is called string.
char name[120];
 

Opearators

Operators are used to calculate value and c++ has set of rich operators.
some popular operators are
 
  1. delete: Memory release operator
  2. new: To allocate new memory
  3. endl: Line feed operator
  4. setw: Feild width operator
© 2016 - 2022, All Rights are Reserved.