Identifiers

Variable, function, and user-defined type names are all examples of identifiers. In C/C++, identifiers are sequences of letters, digits, and underscores from one to several characters in length. (A digit cannot begin a name, however.)

Identifiers may be of any length. However, not all characters will necessarily be significant. There are two types of identifiers: external and internal. An external identifier will be involved in an external link process. These identifiers, called external names, include function names and global variable names that are shared between files. If the identifier is not used in an external link process, it is internal. This type of identifier is called an internal name and includes the names of local variables, for example. In C89, at least the first 6 characters of an external identifier and at least the first 31 characters of an internal identifier will be significant. C99 has increased these values. In C99, an external identifier has at least 31 significant characters and an internal identifier has at least 63 significant characters. In C++, at least the first 1,024 characters of an identifier are significant.

The underscore is often used for clarity, such as first_time, or to begin a name, such as _count. Uppercase and lowercase are different. For example, test and TEST are two different variables. C/C++ reserves all identifiers that begin with two underscores, or an underscore followed by an uppercase letter.




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net