title: Why can;t I printf the 2-D array by array[][] format?
body: <p>I am practicing my C program currently and I want to calculate two 2D matrix.</p>
  
  <p>But I get confused when I use <code>printf()</code> to check these arrays. They break the program.</p>
  
  <p>Code as below:</p>
  
  <pre><code>int matric_multi_main()
  {
      int m1_row = 0;
      int m1_col = 0;
      int m2_row = 0;
      int m2_col = 0;
      int **matric1;
      int **matric2;
  
      printf("Please enter Matric 1 row: ");
      scanf("%d", &amp;m1_row);
      printf("Please enter Matric 1 column: ");
      scanf("%d", &amp;m1_col);
      printf("Please enter Matric 2 row: ");
      scanf("%d", &amp;m2_row);
      printf("Please enter Matric 2 column: ");
      scanf("%d", &amp;m2_col);
  
      if (m1_col != m2_row)
      {
          printf("Error matric size!!!\n");
  
          return 0;
      }
  
      /* Allovate memory for matric 1 */
      matric1 = malloc(m1_row * sizeof(int *));
      for (int i = 0; i &lt; m1_row; i++)
      {
          matric1[i] = malloc(m1_col * sizeof(int));
      }
  
      /* Allovate memory for matric 2 */
      matric2 = malloc(m2_row * sizeof(int *));
      for (int i = 0; i &lt; m2_row; i++)
      {
          matric2[i] = malloc(m2_col * sizeof(int));
      }
  
      /* Init matric 1 */
      for (int i = 0; i &lt; m1_row; i++)
      {
          for (int j = 0; j &lt; m1_col; j++)
          {
              printf("[%d, %d] = ", i, j);
              scanf("%d", matric1+i*m1_row+j);
          }
      }
  
      /* Init matric 2 */
      for (int i = 0; i &lt; m2_row; i++)
      {
          for (int j = 0; j &lt; m2_col; j++)
          {
              printf("[%d, %d] = ", i, j);
              scanf("%d", matric2+i*m2_row+j);
          }
      }
  
      for (int i = 0; i &lt; m1_row; i++)
      {
          printf("[");
          for (int j = 0; j &lt; m1_col; j++)
          {
              //printf("%d ", *(matric1 + i*m1_row + j));  &lt;- correctly
              //printf("%d ", &amp;matric1[i][j]);  &lt;-- display the data with wrong order
              printf("%d ", matric1[j][i]); &lt;- break the program
          }
          printf("]\n");
      }
  
      for (int i = 0; i &lt; m2_row; i++)
      {
          printf("[");
          for (int j = 0; j &lt; m2_col; j++)
          {
              //printf("%d ", *(matric2 + i*m2_row + j));
              printf("%d ", matric2[i][j]);
          }
          printf("]\n");
      }
  }
  </code></pre>
  
  <p>I think I can use <code>matric1[i][j]</code> to get the correct data directly.</p>
  
  <p>But the example on the website always use <code>array[][]</code> directly.</p>
  
  <p>I can understand the different between my program and example.</p>