Identifier A name associated with a function or data object and used to refer to that function or data object.
Remember that an identifier must start with a letter or underscore:
(Identifiers beginning with an underscore have special meanings in some C++ systems, so it is best to begin an identifier with a letter.)
Here are some examples of valid identifiers:
sum_of_squares J9 box_22A GetData Bin3D4 count
And here are some examples of invalid identifiers and the reasons why they are invalid:
Invalid Identifier
Explanation
40Hours
Identifiers cannot begin with a digit.
Get Data
Blanks are not allowed in identifiers.
box-22
The hyphen (-) is a math symbol (minus) in C++.
cost_in_$
Special symbols such as $ are not allowed.
int
The word int is predefined in the C++ language.
The last identifier in the table, int, is an example of a reserved word. Reserved words are words that have specific uses in C++; you cannot use them as programmer-defined identifiers. Appendix A lists all of the reserved words in C++.
Reserved Word A word that has special meaning in C++; it cannot be used as a programmer-defined identifier.