Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You got it slightly wrong: <code>moreThings</code> also decays to a pointer to the first element, but since it is an array of an array of chars, the first element is an "array of 8 chars". So the decayed pointer is of this type:</p> <pre><code>char (*p)[8] = moreThings; </code></pre> <p>The <em>value</em> of the pointer is of course the same as the value of <code>&amp;moreThings[0][0]</code>, i.e. of the first element of the first element, and also the same of <code>&amp;a</code>, but the <em>type</em> is a different one in each case.</p> <p>Here's an example if <code>char a[N][3]</code>:</p> <pre><code>+===========================+===========================+==== |+--------+--------+-------+|+--------+--------+-------+| || a[0,0] | a[0,1] | a[0,2]||| a[1,0] | a[1,1] | a[1,2]|| ... |+--------+--------+-------+++--------+--------+-------++ ... | a[0] | a[1] | +===========================+===========================+==== a ^^^ ||+-- &amp;a[0,0] |+-----&amp;a[0] +-------&amp;a </code></pre> <ul> <li><p><code>&amp;a</code>: address of the entire array of arrays of chars, which is a <code>char[N][3]</code></p></li> <li><p><code>&amp;a[0]</code>, same as <code>a</code>: address of the first element, which is itself a <code>char[3]</code></p></li> <li><p><code>&amp;a[0][0]</code>: address of the first element of the first element, which is a <code>char</code></p></li> </ul> <p>This demonstrates that different objects may have the same address, but if two objects have the same address <em>and</em> the same type, then they are the same object.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload