I'm new to C and our professor has given us a performance assignment where we have to manipulate some 2d arrays. I'm trying to figure out how to correctly move a value between two arrays. I believe using the *(array*i+j) might help speed things up but I cannot get it to compile. I am aware that array[i][j] is usually acceptable but I need to get this to be as fast as possible. A problem line would look something like
out[x] = *( *(in+i) + j);
The error I'm getting is "incompatible types when assigning to type int[10000] from type int. should I be making pointers for out and in? I am not allowed to change the implementation which is
define N 10000
/* The input matrix */
long in[N][N];
/* The output matrix */
long out[N][N];
I am certain the answer is depressingly obvious but none of my changes have worked. I just want to change the value at out[x] or out+x.