470,815 Members | 1,300 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Re: Two dimensional array Question

On May 9, 6:18*am, mdh <m...@comcast.netwrote:
On May 8, 8:54*pm, Barry Schwarz <schwa...@dqel.comwrote:
The C99 standard uses the term "multidinensional array" so K&R is
slightly out of date in this regard.
>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
What do you mean by "2". *Is it an array of char arrays and the first
of such holds the string '2' '\0'?

I am using Xcode...not that that probably makes any difference.
Initially arr[2][13] is declared as a char array. In the debugger
window, there is a column for value and the "initial" value of arr is
"2". If one expands this, then one sees 2 arrays of 13 elements, and
Unless you initialized the array or assigned some data to its
elements, what you are looking at is residual garbage, what the
standard calls an indeterminate value.
as you say below, these seem to be contiguous. I was trying to find a
way of seeing what the address of each element is, but have been
unable to do so....
If you want the address of an object, any object, aggregate or scalar,
you use the & operator on that object. &arr, &arr[1], &arr[0][5] will
all evaluate the addresses of the objects specified. If you are
lookinjg for a way to display the address in your debugger, then you
need to ask in a newgroup where that debuggerf is topical.

Jun 27 '08 #1
0 880

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Todd | last post: by
6 posts views Thread by Ruben | last post: by
4 posts views Thread by Balaskas Evaggelos | last post: by
6 posts views Thread by fniles | last post: by
272 posts views Thread by Peter Olcott | last post: by
5 posts views Thread by nelly0 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.