程序员面试题精选100题(51)-顺时针打印矩阵[算法] (5)

时间:2019-09-22 编辑:多美文
        }

}

剩下的三个函数与此类似,代码依次如下:

void PrintAColumnIncreasingly(int** numbers, int columns, int rows,

                                  int x, int firstY, int lastY)

{

        for(int i = firstY; i <= lastY; ++i)

        {

                int number = *(*(numbers + i) + x);

        printf("%d\t", number);

        }

}

void PrintARowDecreasingly(int** numbers, int columns, int rows,

                                int y, int firstX, int lastX)

{

        for(int i = firstX; i >= lastX; --i)

        {

                int number = *(*(numbers + y) + i);

        printf("%d\t", number);

        }

}

void PrintAColumnDecreasingly(int** numbers, int columns, int rows,

                                  int x, int firstY, int lastY)

{

        for(int i = firstY; i >= lastY; --i)

        {

本文已影响
相关文章