title: Indirection Operator and Pointers to Array
body: <p>It seems the regular definition of the indirection operator doesn't apply when it is used on multi-dimensional arrays:</p>
  
  <pre><code>int arr[10][10][10];
  </code></pre>
  
  <p>If you dereference arr, you'll get the same address:</p>
  
  <pre><code>(void*)arr == (void*)*arr &amp;&amp; (void*)*arr == (void*)**arr
  </code></pre>
  
  <p>This makes sense though - a multi-dimensional array is just a contiguous region of memory, where the pointer points at the beginning of the memory. The compiler essentially ignores dereferences and just computes the proper offset. Use of the indirection operator seems to only preserve the abstraction of multi-dimensional arrays and make it fit with the other syntactic constructs of the language.</p>
  
  <p>If you do the following:</p>
  
  <pre><code>int *** ptr = (int***) arr;
  </code></pre>
  
  <p>And dereference ptr, you'll see the normal dereference behavior, where the value in the location specified by the pointer is returned. Using the above cast, you'll read into undefined memory if you dereference the pointer more than twice.</p>
  
  <p>I'm just wondering why this behavior isn't documented in more places - that is, the difference of effect of the indirection operator on pointers to arrays vs pointers to pointers and pointers to values?</p>