title: Copy data from one matrix to another
body: <p>In C++, I am trying to copy data from one matrix to another. My code is as follows:</p>
  
  <pre><code>int data[height][width];
  void MyCode::setData ( int newData[height][width] )
  {   
      for ( int i = 0; i &lt; height; i ++ )
      {
          for ( int j = 0; j &lt; width; j ++ )
          {
              data[i][j] = newData[i][j];
          }   
      }       
  }
  </code></pre>
  
  <p>My problem here is, these "for" loops are too time consuming, and the code stops just here (maybe the memory is overloaded, I am reading video frames). I wondered about using pointers, like this: </p>
  
  <pre><code>int* data[height][width];
  void MyCode::setData ( int* newData[height][width] )
  {   
       data = newData;
  }
  </code></pre>
  
  <p>But it didn't work, I don't know the reason. Could someone suggest me a better solution for this? </p>