title: Behavior of 2D arrays
body: <p>I have created a 2D array, and tried to print certain values as shown below:</p>
  
  <pre><code>int a[2][2] = { {1, 2}, 
                  {3, 4}};
  
  printf("%d %d\n", *(a+1)[0], ((int *)a+1)[0]);
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>3 2
  </code></pre>
  
  <p>I understand why <code>3</code> is the first output (<code>a+1</code> points to the second row, and we print its <code>0th</code> element.</p>
  
  <p>My question is regarding the second output, i.e., <code>2</code>. My guess is that due to typecasting <code>a</code> as <code>int *</code>, the 2D array is treated like a 1D array, and thus <code>a+1</code> acts as pointer to the <code>2nd</code> element, and so we get the output as <code>2</code>.</p>
  
  <p>Are my assumptions correct or is there some other logic behind this?<br>
  Also, originally what is the type of <code>a</code> when treated as pointer <code>int (*)[2]</code> or <code>int **</code>?</p>