The C++ Data Types
Constant Pointers, Pointers to Constants, and References to Constants
A constant pointer: int I, int *const cp = &I;
// cp is initialized to point to I
// cp can not point to any other object
A pointer to a constant: const int ci = 10; const int* pc = &ci;
// pc is variable pointer to a constant integer
*pc = 15 // this gives an error, ci is a constant integer
reference to a constant: const float pi = 3.1.1;
const float& unit_circle_area = pi;
A constant reference can also be defined for a variable data object
double x; const double& xr = x; // xr can be a function argument
// xr refers to x as a const data object of type double
xr = 10.0; // gives error, where x = 10.0; x *= 100.0; // are OK