This is an old revision of the document!
Table of Contents
Conventions for Identifiers
In a programming language, and identifier is a name associated with a user declared item in the program. This may include variables, constants, types, functions, or other items.
There are two basic conventions that simplify program comprehension when creating identifiers. Identifiers name should be meaningful and should follow the formatting convention.
Identifier Formatting Convention
By correctly formatting an identifier, readers of the program are able to instantly determine the type of identifier they have encountered.
Variables
Variables names should begin with a lower case letter. If the name contains more than one word, each additional word should begin with an upper case letter. This is known as camel case.
Examples of acceptable use:
int price; float costToConsumer; double numberOfCars;
Examples of unacceptable use:
int size_of_house; double PAY_AMOUNT;
Named Constants
Named constants should be declared in all upper case letters, with the underscore seperating multiple words.
Exa
Functions
Classes
Meaningful Identifier Names
One key to self documenting code is to make identifier names that makes the code more readable without comments. While meaningful is somewhat open to interpretation, programmers should strive to produce c identifier names that support clear interpretation of the code.