随记------代码片段

时间:2014-06-11 13:29:59   收藏:0   阅读:303

1. 二维数组转置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void matrix_transpose(int *src[], int *dst[], int x, int y)
{
    int i, j;
    int *psrc, *pdst;
    i = j = 0;
 
    psrc = (int *)src;
    pdst = (int *)dst;
    for(i = 0; i < x; i++)
    {
        for(j = 0; j < y; j++)
        {
            *(pdst + j*x + i) = *(psrc + i*y + j);
        }
    }
}

  

随记------代码片段,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!