title: How to use pointer to pointer for passing matrix?
body: <p>Passing matrix as a pointer to pointer to function not working.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void printMatrix(int **matrix, int row, int col)
  {
      for (int i = 0; i &lt; row; i++)
      {
          for (int j = 0; j &lt; col; j++)
              printf("%d ", matrix[i][j]);
          printf("\r\n");
      }
  }
  void printM (size_t row, size_t col, int matrix[3][4])
  {
      for (int i = 0; i &lt; row; i++)
      {
          for (int j = 0; j &lt; col; j++)
              printf("%d ", matrix[i][j]);
          printf("\r\n");
      }
  }
  int main() 
  {
      int M[3][4];
      for (int i = 0; i &lt; 3; i++)
          for (int j = 0; j &lt; 4; j++)
              M[i][j] = 4*i+j;
  
      printM(3, 4, M);
  
      int *row = *M;
      printMatrix(&amp;row, 3, 4);    //not working
  }
  </code></pre>
  
  <p>Function <code>printM</code> works, but I would like to know how to use pointer to pointer correctly, thanks for help.</p>