a pointer to a constant int. I may change the pointer, but I may not change the value:
const int* a; a constant pointer to an int. I may not change the pointer, but I may change the variable's value:
int* const a; now, how do things look like if I'm dealing with a pointer to a pointer?
int** a; how do I:
a) declare a const pointer to a non-const pointer to a non-const int
b) declare a non-const pointer to a const pointer to a non-const int
c) declare a non-const pointer to a non-const poiinter to a const int ?
static const char* foo[1000]with a dynamically allocatedstatic char** fooand the compiler didn't allow me to assign string literals to the elements of fooconstkeyword binds to the thing to its immediate left. (Unlessconstappears very first, in which case it binds to the thing to its immediate right.)constkeyword signals an intention that the item should be stored in the device’s Program ROM rather than copied from that ROM to program RAM on startup. Most embedded systems have more ROM than RAM, so this is an important distinction when you’re close to the system’s memory limits.