title: Multiplying two 3x3 matrices in C
body: <p>I am trying to multiply two 3x3 matrices. The first 2 numbers in the first 
  and second row are the only correct answer. What am I doing 
  wrong? Is the stuff I need declared in <code>mult_matrices</code>?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void mult_matrices(int a[][3], int b[][3], int result[][3]);
  void print_matrix(int a[][3]);
  
  int main()
  {
      int p[3][3] = {{1, 2, 3},{4, 5, 6}, {7, 8, 9}};
      int q[3][3] = {{10, 11, 12}, {13, 14, 15}, {16, 17, 18}};
      int r[3][3];
  
      mult_matrices(p, q, r);
      print_matrix(r);
  }
  
  void mult_matrices(int a[][3], int b[][3], int result[][3])
  {
      int i, j, k;
      for(i = 0; i &lt; 3; i++)
      {
              for(j = 0; j &lt; 3; j++)
              {
                      for(k = 0; k &lt; 3; k++)
                      {
                              result[i][j] +=  a[i][k] *  b[k][j];
                      }
              }
      }
  }
  
  void print_matrix(int a[][3])
  {
      int i, j;
      for (i = 0; i &lt; 3; i++)
      {
              for(j = 0; j &lt; 3; j++)
              {
                      printf("%d\t", a[i][j]);
              }
              printf("\n");
      }
   }
  </code></pre>