const char* const a[] (can also be written as char const * const a[])
...a is an array of C-string pointers. It could be used in a declaration of a local variable or a function parameter. Here is what each of the const keywords means:
first const: cannot change the contents of the C-string that a[i] points to, as in strcpy(a[i], "Hello"); or a[i][0] = 'H';.
second const: cannot set a[i] to point to some other C-string, as in a[i] = "Hi"; . It's used primarily for function parameter declarations, and not for local variable declarations.
In array notation, a can never be set to point to something else, as in a = 0;
const X* const a[] (can also be written as X const * const a[])
...a is a dynamic array of pointers to objects of the class X. Here is what each of the const keywords means:
first const: cannot change what a[i] points to, as in a[i]->aDataMember = 0; or a[i]->aMutatorFunction();
second const: cannot set a[i] to point to something else, as in a[i] = new X; , so it's used primarily for function parameter declarations, and not in local variable declarations like the example above.
In array notation, a cannot be set to point to something else, as in a = 0;
const char* const * const p (can also be written as char const * const * const p)
...p is a pointer to an array of C-string pointers. It could be used in a declaration of a local variable or a function parameter. Here is what each of the three const keywords means:
first const: cannot change the contents of the C-string that p[i] points to, as in strcpy(p[i], "Hello"); or p[i][0] = 'H';.
second const: cannot set p[i] to point to some other C-string, as in p[i] = "Hi"; . It's used primarily for function parameter declarations, and not for local variable declarations.
third const: cannot set p to point to something else, as in p = 0;
const X* const * const p (can also be written as X const * const * const p)
...p is a pointer to an array of pointers to objects of the class X. Here is what each of the three const keywords means:
first const: cannot change what p[i] points to, as in p[i]->aDataMember = 0; or p[i]->aMutatorFunction();
second const: cannot set p[i] to point to something else, as in p[i] = new X; , so it's used primarily for function parameter declarations, and not in local variable declarations like the example above.
third const: cannot set p to point to something else, as in p = 0;