C++ Tokens:

A C++ program is made up of different tokens combined. These tokens include:

  • Keywords
  • Identifiers
  • Constants
  • String Literal
  • Symbols & Operators

Keywords

Keywords are reserved terms that cannot be used to name variables or functions elsewhere in the programme. They are only utilised for the purpose for which they were designed. Their predetermined functions are known.

Return is one such keyword that is used to create return statements for functions. Auto, If, Default, and others are additional examples.

There is a list of reserved keywords that the programmer cannot overload or reuse.

Identifiers

Variables and functions are assigned identifiers in order to distinguish them from one another. Although their definitions are entirely up to us, there are some guidelines we must abide by when naming identifiers. One such restriction states that special symbols like @, -, *,, etc. are not permitted in the name.

Due to the case-sensitivity of the C++ language, an identifier with a capital letter and one with a tiny letter at the same location will behave differently. For instance, the phrases “Code,” “code,” and “cOde” can be used to identify three different things.

Constants

Constants can also be of any data type and are quite similar to variables. A constant’s value never changes, which is the only distinction between a constant and a variable. In the upcoming tutorials, constants will be covered in greater detail.

Literal strings

The characters in a string literal or string constant are encapsulated in double quotation marks. String literals also include escape patterns.

Operators and Symbols

Symbols are unique characters used to carry out specific functions. By using them, you can tell the compiler what certain operations should be made on the supplied data. Numeral operators like +, * and bitwise operators like & are a few examples of symbols.

Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in