data types, applying the const qualifier is straightforward. It can go on either side of some types for historical reasons (for example, const char foo = 'a'; is equivalent to char const foo = 'a';). On some implementations, using const twice (for instance, const char const or char const const) generates a warning but not an error. Pointers and references For pointer and reference types, the meaning of const is more complicated – either the pointer itself, or the value being pointed to, or both, can be const. Further, the syntax can be confusing. A pointer can be declared as a const pointer to writable value, or a writable pointer to a const value, or const pointer to const value. A const pointer cannot be reassigned to point to a different object from the one it is initially assigned, but it can be used to modify the value that it points to (called the pointee). Reference variables in C++ are an alternate syntax for const pointers. A pointer to a const object, on the other hand, can be reassigned to point to another memory location (which should be an object of the same type or of a convertible type), but it cannot be used to modify the memory that it is pointing to. A const pointer to a const object can also be declared and can neither be used to modify the apointee nor be reassigned to point to another object. The following code illustrates these subtleties: void Foo( int * ptr, int const * ptrToConst, int * const constPtr, int const * const constPtrToConst ) { *ptr = 0; // OK: modifies the pointed to data ptr = NULL; // OK: modifies the pointer *ptrToConst = 0; // Error! Cannot modify the pointed to data ptrToConst = NULL; // OK: modifies the pointer *constPtr = 0; // OK: modifies the pointed to data constPtr = NULL; // Error! Cannot modify the pointer *constPtrToConst = 0; // Error! Cannot modify the pointed to data constPtrToConst = NULL; // Error! Cannot modify the pointer } C convention Following usual C convention for declarations, declaration follows use, and the * in a pointer is written on the pointer, indicating dereferencing. For example, in the declaration int *ptr, the dereferenced form *ptr is an int, while the reference form ptr is a pointer to an int. Thus const modifies the name to its