/* */ Click to Join Live Class with Shankar sir Call 9798158723

C++ Identifiers


Identifiers : It is a collection of alphabets, special characters underscore which are represent or use to write various programming elements. Such as : variable, function, array, structure, union, labels are known as identifier.

Some naming rules are common in both C and C++. They are as follows:

  1. First character in a identifier should be a letter or underscore "-".
  2. No other punctuation and special symbols are allowed.
  3. These are case sensitive, which means NUM1 and num1 are not the same identifiers.
  4. Lenght of an identifier should be maximum of 31 character
  5. A declared keyword cannot be used as a variable name.

Whatever we use to write C++ program is known as identifier. Identifier name must differ in spelling as case from any keyword. We cannot use keywords as identifier.

Example :

#include < stdio.h>
int main()
{,
int a=5;
cout<< a;
}

In this example ‘a’ is an identifier as an integer variable and main and 'cout 'are identifier names for function.