previous | start | next

Variables

Variable names may consist of a sequence of letters, digits and underscores.

The first character must be a letter.

There is no limit imposed by C++ on the number of characters in the name of a variable (although some linkers do have limits).

Variable must be declared giving the type, the name, and optionally, an initial value for the variable.

    

    int x;
    bool result;
    const double pi = 3.1415926535897932384626433832795;

    (Note: The const qualifier used in the declaration of
    the variable pi means that this variable's value cannot be
    changed. In particular it is illegal to later try to assign a new
    value to pi.)

     

    int i,j,k;

   


previous | start | next