Identifiers in C++


Identifiers can be defined as the name of the variables and some other program elements using the combination of the following characters.

Alphabets   : A to Z,   a to z

Numbers      : 0  to 9

Underscore : _

Some other   :  like [],blank space,( ),*, & etc.

In C++ upper case and lower case letters are distinct and hence there are 52 letters in all.C++ does not set a maximum length for identifier.Some example of valid identifiers are as follows:

My_name , a , A,  k_ Love   etc.

In above examples the a and A identifiers are distinct and the underscore character is counted as a letters.Some invalid identifiers are :

3sd         -variable begin with a digits

roll no    – space between characters of a single variable

Comments are closed.