C++ Tokens

As mentioned earlier, C++ is the superset of C and so most constructs of C are legal in C++ with their meaning and usage unchanged. So tokens, expressions, and data types are similar to that of C. It also is preferred to understand the concepts of C before learning C++. However, there are some exceptions and additions in C++ which you will not get in C. In this chapter, you will learn about what are tokens, and the different types of tokens, expressions, and basic data types.

What are Tokens

Each word and punctuation is referred to as a token in C++. Tokens are the smallest building block or smallest unit of a C++ program.

These following tokens are available in C++:

Identifiers

Identifiers are names given to different entries such as variables, structures, and functions. Also, identifier names should have to be unique because these entities are used in the execution of the program.

Keywords

Keywords are reserved words which have fixed meaning, and its meaning cannot be changed. The meaning and working of these keywords are already known to the compiler. C++ has more numbers of keyword than C, and those extra ones have special working capabilities.

Operators

C++ operator is a symbol that is used to perform mathematical or logical manipulations.

Constants

Constants are like a variable, except that their value never changes during execution once defined.

Strings

Strings are objects that signify sequences of characters.


Scroll Back to Top