A keyword is a word in C++ language that has a predefined meaning and purpose. The meaning and purpose of C++ Keywords are defined by the developer of language. It cannot be changed or redefined by the user. C++ Keywords can be used for the same purpose for which it is defined. C++ Keywords also known as reserved words. There are different types of keywords in C++ language. The total number of keywords is 63.
The identifier is the names used to represent variables, constants, types, functions and labels in the program. The identifier is an important feature of all computer languages. A good identifier name should be descriptive but short.
An identifier in C++ may consist of 31 characters. If the name of an identifier is longer than 31 characters, the first 31 characters will be used. The remaining characters will be ignored by the C++ compiler. Some important roles for the identifier name are as followings.
- The first character must be alphabetic or underscore (_).
- The identifier name must consist of only alphabetic characters, digits or underscores.
- The reserved word cannot be used as an identifier name.
Types of Identifiers in C++
C++ provides the following types of identifiers
Standard Identifiers/User Define
A type of identifier that has special meaning in C++ is known as a standard identifier.
C++ cannot use a standard identifier for the original purpose if it is redefined.
c-out and c-in, are examples of standard identifiers. These are the name of the input/output objects defined in standard input/output library iostream.h.
The type of identifier that is defined by the programmer to access memory location is known as a user-defined identifier. The user-defined identifier is used to store data and program results.
Some examples of user-defined identifiers are b, subjects, and age, etc.