elibraryportal Logo

Identifiers in C++

In C++ variables must be identified with unique names These unique names is known as identifiers.

Identifiers may be names (like x,y & z) or more descriptive names (age, sum, totalVolume) etc.

Example :

The General rules for unique identifiers that is:

  • Names can contain letters, digits & underscores
  • Names must begin with a letter or an underscore (_)
  • Names are case sensitive (myVar and myvar are different variables)
  • Special characters like !, #, %, etc are not allowed for unique name.
  • C++ Reserved words (like keywords, such as int) cannot be used as names