by using nested loop...,
#define R 10
#define C 10
...
...
unsigned int source[R][C];
unsigned int destination[r][c];
int i, j;
...
...
for(i = 0; i < R; i++)
for(j = 0; j < C; c++)
destination[j] = source[j];
...
...
memcpy should work... make sure they are the same size and type if using memcpy unless you are trying to do some type of conversion (i.e. ints to 8 bit values you could use a char array) HOwever if you
unsigned int dim2orig[3][3];
unsigned int dim2copy[3][3];
i am a bit confused... if you are just copying the pointers it does not make sence to me with the memcpy UNLESS you are using a function to do the copy. If you were passing the 2 2-d arrays to a function to perform this, dont use the sizeof and instead pass the size and use that instead.
The problem is that I receive information at high speed in communication. I can't use the nested loops because they are to slow. I must copy the information before I receive the new information.
That's why I use memcpy. It's fast, but I can only use it for 1-dim array.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.