Bill said:
Yes. You were wrong.
const and volatile can appear in many places with types, modifiers,
variable names, and probably other things on either side of them. In
fact, variables don't have to be involved at all:
typedef const int constint;
But 'constint' here has no effect on the program unless it is later
used in a declaration. When you use it in a declaration, a variable
will come into play (that means they do have to be involved).
Use your statement to reconcile that
const int *a;
and
int const *a;
are the same.
'const' modifies the type of the object to its right (it's the object
who is to the right, not the type0. I used 'variable', perhaps that's
what you're picking at, I can't figure it out.
'const' in "const int *a" affects the '*a' (the object to the right of
the const), that is the 'int' to which 'a' points. 'const' in "int const
*a" affects the *a (again). In
const int k, *p; // or 'int const k, *p;'
both 'k' and '*p' are const.
Victor