C++ Identifiers

C++ identifiers are the unique names assigned by the programmer to the variables, constants, functions or classes, etc. For example int age= 27; where “age” is the identifier given by the developer.

To write any identifier you have to follow a set of rules. Let’s take a look at the rules.

  1. All alphabets, digits, and underscores are used to write it.
  2. It can only be started with an alphabet  or underscore
  3. It is a case-sensitive means Logic and logic are two different names
  4. Keywords cannot be used as identifiers.
  5. Special characters like “!”, “%”, “#”, and white spaces are not used to declare it.

Example: Valid C++ identifiers


Example: Invalid C++ Identifiers

Student Marksint2num

More Related Articles

C++ program to calculate average and percentage

C++ program to print star patterns