How C arrays are structured : <p>I have a question about how C arrays are stored in memory. But I'm having trouble formulating the question, so here's my best try to put it into words. I have trouble with English. Let's say we have a three dimensional array:</p>

<pre><code>int foo[2][3][4];
</code></pre>

<p>Elements can be accessed using either array or pointer notation:</p>

<pre><code>foo[i][j][k]    
*(*(*(foo + i) + j) + k)
</code></pre>

<p>We could think of the array as a pointer to a pointer to a pointer to an int, or, for example, a pointer to a 2 dimensional array like (*a)[2][3].</p>

<p>The problem in my thinking is this: I would have thought that in order to 'extract' values in the array, we'd only have to dereference the top level of the array (i.e. [i]) once, the second level (i.e. [j]) twice, and the third level (i.e. [k]) three times. But actually we always have to dereference three times to get to any value. Why is this? Or is this really the case?</p>

<p>I try to imagine the array structure in memory.</p>

<p>Apologies for my poor way to express this.</p>
