identifier in C++ |
Identifiers in c++ Programming Language
The identifier are the names used to represent
variable, constant, 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 then 31 characters, the first 31 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 underscore.
The reserved word cannot be used as identifier name.
Type OF IDENTIFIERS
C++ provide the following type of identifiers:
Standard Identifiers
A type of identifier that has special meaning in C++
is known as standard identifier. C++ cannot use a standard identifier for its original
purpose if it is redefined.
Example
Cout and
cin are example of standard identifiers. These are the names of
input/output objects defined in standard input/output library iostream.h.
User Defined Identifiers
The type of identifier that is defined by the
programmer to access memory location is known as user-defined identifier. The user
defined identifier are used to store data and program result.
Example
Some example of user defined identifiers are a marks
and age etc.
Also Read: C++ Operator Precedence
Post a Comment