Re: Two dimensional array Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Barry Schwarz

    Re: Two dimensional array Question

    On May 9, 6:18 am, mdh <m...@comcast.n etwrote:
    On May 8, 8:54 pm, Barry Schwarz <schwa...@dqel. comwrote:
    >
    >
    >
    The C99 standard uses the term "multidinension al 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
    >elements.
    >
    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.

Working...