title: Printing a dynamic 2D array, C++
body: <p>I'm attempting to print the contents of a dynamically allocated 2D array. However, when I try to subscript an element I get an error. Any help would be appreciated.  </p>
  
  <p>The snippet that makes the array:</p>
  
  <pre><code>   char ** m_points = new char * [m_height];
  
     for (int y_i=0; y_i&lt;m_height; y_i++)
     {
         m_points[y_i] = new char[m_width];
  
         for (int x_i=0; x_i&lt;m_width; x_i++)
             m_points[y_i][x_i] = ' ';   
     }
  </code></pre>
  
  <p>This is supposed to print the arrays contents (<code>cout &lt;&lt; m_points[y_i][x_i]</code> is where the error is occurring):</p>
  
  <pre><code>   for (int y_i=0; y_i&lt;m_height; y_i++)
     {       
         for (int x_i=0; x_i&lt;m_width; x_i++)
             cout &lt;&lt; m_points[y_i][x_i];
  
         cout &lt;&lt; endl;
     }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>invalid types ‘char[int]’ for array subscript
  </code></pre>