< previous page page_50 next page >

Page 50
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif 3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
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:
0050-01.gif
(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 IdentifierExplanation
40HoursIdentifiers cannot begin with a digit.
Get DataBlanks are not allowed in identifiers.
box-22The hyphen (-) is a math symbol (minus) in C++.
cost_in_$Special symbols such as $ are not allowed.
intThe 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++.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif 3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Reserved Word A word that has special meaning in C++; it cannot be used as a programmer-defined identifier.

 
< previous page page_50 next page >