title: Use function to declare array values in a function
body: <p>first, I'm sorry if I mix up some terms like declare/define, etc. I am currently trying to get familiar with them. My problem is: I have to create a big matrix in my code. I wanted to move this into a separate function at the end of my file to keep things more simple. Is there any easy way to do this? I can not use "vector" because I have to hand the matrix at a later point to a function that does not support "vector" (don't ask, this other function was not written by me).</p>
  
  <p>I currently use this code (since it is working), which declares the matrix in the main function so that it does not go out of scope. I hoped that it is possible to assign the values of the matrix directly in the function, but I couldn't make it work. </p>
  
  <pre class="lang-cpp prettyprint-override"><code>void make_matrix(float (&amp;matrix_float)[255][4]);
  
  int main()
  {
      // ...
      float matrix[255][4]{ 0 };
      make_matrix(matrix);
      // ...
  }
  
  void make_matrix(float (&amp;matrix_float)[255][4])
  {
      float preparation[255][4]{ { 0, 0, 0, 0 },
                                 { 0.639999985694885, 0, 0.800000011920929, 1 },
                                 { 0, 1, 0, 1 },
                                 // ........
                               };
  
      for (int i = 0; i &lt; 255; i++)
          for (int j = 0; j &lt; 4; j++)
          {
              {
                  matrix_float[i][j] = preparation[i][j];
              }
          }
  }
  </code></pre>
  
  <p>Is there a more elegant way to do it?</p>