C++ Keywords and Identifiers

C++ Keywords

Here, the Keywords are the words which are already predefined, reserved identifiers having its own special meaning. Keywords cannot be used as variables or the identifiers because keywords have their own meaning for their own use. C++ uses a set of keywords which is reserved for its own purpose. The reserved words are known as keywords. Well, the keywords are the parts of the C++ tokens. They are distinct and they cannot be further classified.

If the programmer tries to use keywords as variables or the identifiers in the program then it will show the issue in the compiler. Keywords always start with the lower case. It can not be changed by the user.

Some of the Keywords are listed below:

autodoublegotoshort
breakelseifsigned
caseenumwhilereturn
charexterndostruct
constfloatregisterswitch
continuefarintcatch
defaultforlongunion
designedvoidnearstatic

 

C++ Identifiers

The name of the class, function and the variables or the different entity in C++ is known as an identifier. Here, the variables name is a name given to the memory location where different constants are stored and given the flexibility to name the identifiers as programmers wish. Identifiers cant be the keywords.

Rules for constructing Identifiers/Variables:

  • The variable name can contain letters, digits, and the underscore(_).
  • The first character of the variable name must be the letter.
  • The underscore is also legal first character it is not advised. Eg: 25summer – illegal, e23 – legal
  • No comma and blank spaces are allowed within a variable name.
  • No special symbols except underscore are allowed.
  • Case matters(that is upper case and lower cases). Eg: Area, ARea, area, AREA are the different variables.
SHARE C++ Keywords and Identifiers

You may also like...

Leave a Reply

Your email address will not be published.

Share