C++ Identifiers

C++ identifiers in a program are utilized to refer to the name of the variables, functions, arrays, or other user-defined data types made by the programmer. They are the essential requirement of any language. Each language has its own rules for naming the identifiers.

C++ identifiers


C++ supports many various types of identifiers which are given below:

  • Constants
  • Variables
  • Functions
  • Labels
  • Defined data types


Rules for naming identifiers in c++

  • Identifiers can be made out of letters, digits, and the underscore character.
  • It has no restriction on name length.
  • It should start with either a letter or an underscore.
  • It is case-sensitive.
  • We can't involve keywords as identifiers.
  • We can pick any name as an identifier in the event that we follow the above guidelines. However, we should give meaningful names to the identifier that makes sense.


Invalid Identifier Bad Identifier Good Identifier
Total points T_points totalPoint
1list list_1 list1
float n_float floatNumber



Previous                                                                                         Next