Constants and variables
Bool type is new. Takes true and false values;
Const variables are unchangeable. Like old #defines but with type
checking. A const variable can be changed if the const is cast away by:
Enumeration types are extended to allow user defined values
Enum ages ( laura=7,ira,harold=59); ira would be 8.
Extern variables are visible everywhere within a program. Static
extern variables are only visible within the file they are declared.
Reference variables. You can provide an alias for a variable.
Kind of like a pointer. References to the alias are the same as
references to the variable. For example.
Double& last=a; make last a new name for a.
Last = 6; same as a=6.
Int a = 5; // declaration
Int *p = &a; // p points to a, contains the address of a
Int& ref_a = a; // ref_a is an alias for a
*p=7; // a is assigned 7, *p is the lvalue of the memory
location for a
a = *p+1; // a becomes 8 as *p retrieves the value of 7
ref_a=9; // a is set to 9
p can point to any integer but ref_a only refers to a. See pass by reference.