Copy 2D array to another 2D array.

Hello. Asking for help about copying 2D arrays.
For example :
I have an array - float a[50][50]. Users input numbers themselves. How can i copy those numbers to another array - float b[50][50] ?
1
2
3
4
5
6
7
for (int x=0 ; x < 50; x++)
{
  for (int y=0 ; y < 50; y++)
  {
    b[x][y] = a[x][y];
  }
}



Alternatively;
 
memcpy (b, a, 50*50*sizeof(float));

or
std::copy(&a[0][0], &a[0][0]+50*50,&b[0][0]);
Last edited on
@Repeater , thanks, was using the same thing, but seems that something was missing. This one worked :)
Topic archived. No new replies allowed.