Identifiers

Default Image

In real life we use different names to
identify things, same as we use identifiers to know make names for
different objects, variables, functions. In C++ programme an identifier
may consist maximum 31 characters. If name length is greater than 31
then compiler will identify first 31 characters and skip others. These
rules are followed to name an identifier:

  • Identifier may consist on alphabets, digits and underscore.
  • The first character of identifier must be an alphabet or underscore.
  • It should not be a keyword.


There are two types of identifiers: standard (pre-defined) and user-defined.


Standard identifiers:


The identifiers that are defined already
called standard identifiers. They are used in source code for special
purpose. Each of them have special meaning in C++. Some examples of
standard identifiers are cin (used to get data from user) cout (show
output on screen) gets()(get a string during programme expectation)
getch()(get a character from user) getche()(get a character from user
and show it on screen) clrscr()(clear raw data or previous outputs from
screen). They were example of some standard identifiers defined by the
developers.


User-defined identifiers:


The identifiers that are defined by a
user for custom use called user-defined identifiers. They could be
variable names, user-defined functions. In the topic of token variables
name a, b and c were example of user defined identifiers.

Read Count: 3 times

Comments

No comments yet.

Leave a Comment