title: implementing a function with matrix - differences
body: <p>I have the following function which prints a matrix:</p>
  
  <pre><code>void printMat(int* mat, int size)
  {
      int i;
      for (i=0 ; i &lt; size ; i++)
          printf("%d ", mat[i]);
      printf("\n");
  }
  </code></pre>
  
  <p>Now, suppose I have a certain matrix and I want to implement the print of it by passing it to the function above in three ways:</p>
  
  <pre><code>void main()
  {
      int mat[2][3] = { {1,2,3}, {4,5,6} };
  
      printMat((int*)mat, 6);     //first way//
      printMat((int*)mat+1, 6);   //second way//
      printMat(mat+1, 6);         //third way//
  }
  </code></pre>
  
  <p>In the <strong>first</strong> way, the function actually gets the starting address of the matrix. That I understand.</p>
  
  <p>However, I don't understand why in the first way the function actually gets the <strong>address of the second element</strong> in the matrix, and not the <strong>address of the second line</strong> in the matrix (<strong>whereas the latter is being implemented actually by the third way</strong>).</p>