title: Copy a matrix/2d array to another in c++
body: <p>I am trying to copy a 2d array into another 2d array, i have these two array created:</p>
  <pre><code>#define mapXcor 50
  #define mapYcor 50
  
  char secondStage    [mapXcor][mapYcor];
  char currentStage   [mapXcor][mapYcor];
  //mapXcor and mapYcor are constant integers
  </code></pre>
  <p>Now my <code>secondStage[][]</code> array is populated with values on it, but <code>currentStage[][]</code> isn't, and i want to assign the values of <code>secondStage</code> to <code>currentStage</code>. So i created the function bellow:</p>
  <pre><code>void populateArray(char (&amp;arrayA)[mapXcor][mapYcor], char arrayB[mapXcor][mapYcor]) {
      for(int a = 0; a &lt; mapXcor + 1; ++a) {
          for(int b = 0; b &lt; mapYcor + 1; ++b) {
              arrayA[mapXcor][mapYcor] = arrayB[mapXcor][mapYcor];
          }
      }
  }
  
  populateArray(currentStage[mapXcor][mapYcor],secondStage[mapXcor][mapYcor]);
  </code></pre>
  <p>But when i use the function it gives me a error :</p>
  <blockquote>
  <p>1   IntelliSense: a reference of type &quot;char (&amp;)[20][50]&quot; (not const-qualified) cannot be initialized with a value of type &quot;char&quot;</p>
  <p>2   IntelliSense: argument of type &quot;char&quot; is incompatible with parameter of type &quot;char (*)[50]&quot;</p>
  </blockquote>
  <p>How could I fix this?</p>