Quote:
> I would like to point out the differences between
> int const a, b;
> and
> int * const pa, pb;
> if I am correct, b is const while pb isn't!
You're, IMHO, but also note that pb isn't a pointer either.
I very much liked Peter van der Lindens descriptions of how to
read complicated declarations and definitions in his book
"Expert C Programming". The precedence rules Peter mentions
also state:
...
C If a const and/or volatile keyword is next to a type
specifier (e.g. int, long, etc.) it applies to the type
specifier. Otherwise the const and/or volatile keyword
applies to the pointer asterisk on its immediate left.
That means:
int const *p;
const int *q;
are pointers to read-only ints, whereas
int * const r;
is a read-only pointer to an int.
it gets sort of complicated when we have more than one
definiton/declaration on one line:
int const *p, i, * const q;
here p ist a pointer to a read-only int, i is such a read-only
int and q is read-only pointer to a read-only int.
HTH, HAND
--
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond