title: How to return 2d array C++
body: <p>I have a function that needs to return a 2d array, I'm new in c++ but I searched a lot and the best I got is that, which gives &quot;error: cannot convert 'int** (*)[3]' to 'int**' in return&quot;.</p>
  <pre><code>int** initial_state()
  {
      int arr[3][3] =
          {
              {0, 0, 0},
              {0, 0, 0},
              {0, 0, 0}}
          ;
  
      return arr;
  }
  </code></pre>