Walter said:
:> > void f( char (*ptr)[] );
:> In the first, there is a hint to the reader that what is pointed
:> to is a constant pointer
:Where? I don't see 'const' anywhere.
I said a hint to the reader, not a hint to the compiler.
array[subscript] where array is a variable (rather than an expression)
implies that the array location is a constant far as that block of code
is concerneid, so when someone takes the trouble to write the extra
() and [] then they are usually trying to emphasize that what ptr points
to is a value that is not going to change.
I had to read your post a couple times to figure out what you 'mean.'
You're thinking of accessing 2 dimensional arrays with two levels of
indirection --which is correct-- but you are assuming a mechanism where
there is an array of "constant intermediate stage pointers" that point
to the subarrays. You are better off not thinking this way, because
there really isn't an array of pointers that holds together 2
dimensional arrays in the execution evironment. The mechanism by which
double indirection works with 2-dimensional arrays is different, and
your nearest C textbook should explain this.
No matter how many dimensions an array has, the elements are contiguous
in the abstract machine C describes. If an array has more than 1
dimension, these other dimensions (other than the first dimension,
which is dealt via the pointer method you're probably aware of)
describe how to "step over" parts of the contiguous elements to find
the proper element.