The Identifiers are the names used to represent variable, constants, types, functions and labels in the program. 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 character will be used. The remaining characters will be ignored by C++ compiler.
Some important rules for identifier name are as follows :
- The first character must be an alphabetic or underscore ( _ ).
- The identifier name must consist of only alphabetic characters, digits or underscores.
- The reserved word cannot be used as identifier name.
Types of Identifier :
C++ provides the following types of identifiers :
- Standard Identifier :
A type of identifier that has special meaning in C++ is known as standard identifier.
Example :
cout and cin examples of standard identifiers.
2. User-defined Identifiers :
The type of identifier that is defined by the programmer
to access memory location is known as user-defined identifiers.
to access memory location is known as user-defined identifiers.
Example :
Some examples of user-defined identifiers are a, marks and age etc.
No comments:
Post a Comment