M
mdh
I am still having a problem understanding K&RII on p 112. I have
looked at the FAQs --which I am sure answer it in a way that I have
missed, so here goes.
A 2-dim array, (per K&R) is really a 1-dim array, each of whose
elements is an array.
Looking at the debugger I use, arr[2][13] is shown as an initial value
of "2", but when expanded, there are 2 consecutive arrays of 13
elements.
So, may I ask this?
Is there anything special that marks the end of the first 13 elements
from the beginning of the 2nd 13 elements? In other words, it seems to
me that this is nothing more than a 1-dim array, with the information
about the structure of the array provided by the declaration?
Hopefully this makes sense.
The exercise associated with this, used the construct
*p = arr[1 or 0 ] to point to either the "first" or "second" row of
the array. Does the compiler "know" where to point to because it has
been given this information by the declaration of "13" in arr[2][13].
Hopefully this makes sense too!
And lastly, K&R's description of "each of whose elements is an array"
has never made sense to me. It may be that the answer to the above may
clarify it.
Thanks in advance.
looked at the FAQs --which I am sure answer it in a way that I have
missed, so here goes.
A 2-dim array, (per K&R) is really a 1-dim array, each of whose
elements is an array.
Looking at the debugger I use, arr[2][13] is shown as an initial value
of "2", but when expanded, there are 2 consecutive arrays of 13
elements.
So, may I ask this?
Is there anything special that marks the end of the first 13 elements
from the beginning of the 2nd 13 elements? In other words, it seems to
me that this is nothing more than a 1-dim array, with the information
about the structure of the array provided by the declaration?
Hopefully this makes sense.
The exercise associated with this, used the construct
*p = arr[1 or 0 ] to point to either the "first" or "second" row of
the array. Does the compiler "know" where to point to because it has
been given this information by the declaration of "13" in arr[2][13].
Hopefully this makes sense too!
And lastly, K&R's description of "each of whose elements is an array"
has never made sense to me. It may be that the answer to the above may
clarify it.
Thanks in advance.