I originally had the code:
double **u_new,**u;
for(iy=0;iy<Ny;iy++) {
for(ix=0;ix<Nx;ix++) {
u[ix][iy] = u_new[ix][iy];
}
}
Here both u and u_new are two dimensional arrays.
These arrays are quite large therefore I believe it is inefficient to do this and I should be swapping their memory locations instead.
I have created a function called swapmem defined as follows:
void swap_mem(double **array1, double **array2)
{
double *tmp;
tmp = *array1;
*array1 = *array2;
*array2 = tmp;
}
In my code I call
swap_mem(&u,&u_new);
However this doesn't seem to work. I get the warning: passing argument 1 of swap_mem from incompatible pointer type
How can I fix this?