title: Copy 2D array using memcpy?
body: <p>So I want to copy the contents of a 2D array to another array of the exact same type. Here is how the array is created:</p>
  
  <pre><code> GridUnit** newGrid;
   newGrid = new GridUnit*[width];
      for (int i = 0; i &lt; width; i++)
          newGrid[i] = new GridUnit[height];
  </code></pre>
  
  <p>GridUnit is size 16 (4 floats). So that's all initialised fine, no problems with using it as it is after I have ran the for loops to actually fill the values with some data. Now what I want to do is copy the contents of another array into this one (without for loops if possible). This is what I have been trying to do so far:</p>
  
  <pre><code> memcpy(&amp;newGrid, &amp;grid, height * width * 16);
  </code></pre>
  
  <p>'grid' is identical to 'newGrid' in terms of its size and type. However, this does not work. I know the memcpy is possibly not correct, but having tried multiple different setups using this, I don't know what's going wrong with it anymore, so any help would be welcome! </p>