Memorize, memorize, memorize!!!
// value being pointed cannot be changed:
const char * ptr;
// address of the pointer cannot be changed,
// but the value being pointed can be
char * const ptr;
Those rules seem to be simple, but I sometimes forgot about them ;(
// both value and the address of the pointer cannot be changed
const char * const ptr;
More info:
- http://www.possibility.com/Cpp/const.html
- http://www.codeguru.com/cpp/cpp/cpp_mfc/general/article.php/c6967/Constant-Pointers-and-Pointers-to-Constants.htm
sign image taken from: http://openclipart.org/detail/3130/warning-notification-by-eastshores