better approach:
struct bitmap
{
int** array[3]; //RGB
int N;
int M;
};
void f(struct bitmap source, struct bitmap dest)
{ for(int i=0;i<source.N;i++)
{
for(int j=0;j<source.M;j++)
{
dest.array[j][source.N-i-1]=source.array[i][j];
}
}
dest.N=array.M;
dest.M=array.N;
}
Here's a picture
to rotate anti-clockwise you change only
dest.result[source.M-j-1][i]=source.array[i][j];