The smallest units in a program is called token.
C++ has following tokens
- Identifiers
- Keywords
- Constants
- Strings
- 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.
- auto
- break
- continue
- class
- const
- default
- do
- while
- 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
- delete: Memory release operator
- new: To allocate new memory
- endl: Line feed operator
- setw: Feild width operator