Identifiers


  1. The name of a variable is called an identifier since the name identifies the variable.

  2. The variable name is associated with the address of the assigned memory location for that variable.

  3. Should choose legal names that better describe the meaning of the variable.

  4. The following rules govern the naming convention of identifiers:

    • An identifier can have any number of upper or lower case letters, digits or the underscore symbol.

    • An identifier must start with an upper or lower case letter or an underscore (i.e. cannot start with a digit).

    • No other characters are allowed (e.g. characters such as ?@!#* or a blank not allowed).

    • Cannot use any C++ reserved keywords. See Appendix 1 (p. 975 for the sixth edition) for a complete list of C++ keywords.

    • Avoid using identifiers that start with a double underscore since such identifiers are reserved for use by C++ implementations and standard libraries.

    • Also avoid using predefined words that appear in C++ libraries, e.g. cin and cout.