void f(char* dest,char* source,int m,int n) { for(int i=0;i<m*n;i++,++dest) *dest=source[(i%m)*n+i/m]; }