title: Function for Multiplying Two 3x3 Matrices
body: <p>I pass 3 matrices to my <code>multiplyMatrix</code> function. Matrices <code>a</code> and <code>b</code> are entered by the user, and <code>c</code> is the product of <code>a</code> and <code>b</code>. I am getting an error when assigning values to <code>c</code>.</p>
  
  <blockquote>
    <p>expression must be a modifiable Ivalue.</p>
  </blockquote>
  
  <p>Can someone please explain this to me?</p>
  
  <pre><code>const int N = 3;
  void multiplyMatrix(const double a[][N], const double b[][N], const double c[][N])
  {
  
      for (int i = 0; i &lt; N; i++) {
          for (int k = 0; k &lt; N; k++) {
              c[i][k] = a[i][0] * b[0][k] + a[i][1] * b[1][k] + a[i][2] * b[2][k];
          }
      }
  }
  
  int main()
  {
  
      cout &lt;&lt; "Enter matrix1: ";
      double m1[3][N];
      for (int i = 0; i &lt; N; i++) {
          for (int k = 0; k &lt; N; k++) {
              cin &gt;&gt; m1[i][k];
          }
      }
  
      cout &lt;&lt; "Enter matrix2: ";
      double m2[3][N];
      for (int i = 0; i &lt; N; i++) {
          for (int k = 0; k &lt; N; k++) {
              cin &gt;&gt; m2[i][k];
          }
      }
  
      //have to initiliaze matrix to some value for math to work properly!!!
      double m3[3][N] = {};
  
      multiplyMatrix(m1, m2, m3);
  
      return 0;
  }
  </code></pre>