title: Can I access elements of a 2D array using pointers in C++?
body: <p>For 1D array, I can use array name as a pointer and add offset to it to access each element of the array. Is there something similar for 2D arrays?</p>
  
  <p>I defined a 2D array as follows</p>
  
  <pre><code>int arr[2][3] = {{1,2,3}, {4,5,6}};
  
  int** arrPtr = arr;
  </code></pre>
  
  <p>but I got compiler error for the second line. Shouldn't 2D array have type <code>int**</code>?</p>
  
  <p>I came across another thread here:</p>
  
  <p><a href="https://stackoverflow.com/questions/15118917/c-accessing-values-at-pointer-of-2d-array">C++ Accessing Values at pointer of 2D Array</a></p>
  
  <p>and saw this:</p>
  
  <pre><code>2dArray = new int*[size];
  </code></pre>
  
  <p>Could someone please tell me what <code>int*[size]</code> means? (<code>size</code> is an <code>int</code>, I presume).</p>
  
  <p>Thanks a lot.</p>