ma****@gmx.at wrote:
Hello,
if i have these two declarations:
1)const int * test;
and
2)int* const test;
Does the first mean that the value of the integer cannot be changed and
the second one that the location to which the pointer points to cannot
be changed...? or is the other way around?
matti
Others have already confirmed that you are correct. As a tip, these
sorts of declarations, notably ones with brackets or parentheses, can in
general be read right to left:
1) test is a pointer to an int constant
2) test is a constant pointer to an int
For more complicated declarations, check out:
http://www.ericgiguere.com/articles/...larations.html
(it's a bit old and written for C, but the basic ideas still hold)
Finally, there's a handy little UNIX utility that will convert
declarations to english and vice versa. Look for cdecl or c++decl.