/* 使用二维数组型指针作为二维数组形参 */ #include <stdio.h> #define ROW_SIZE 3 #define COL_SIZE 3 void print_array(int (*p)[ROW_SIZE][COL_SIZE]) { int i, j; for (i = 0; i < ROW_SIZE; ++i) { for (j = 0; j < COL_SIZE; ++j) printf("%4d", *(**p + i * COL_SIZE + j)); printf("\n"); } } int main(void) { int array[ROW_SIZE][COL_SIZE] = { { 1, 2, 3 }, { 11, 12, 13 }, { 21, 22, 23 } }; printf("Output the matrix:\n"); print_array(&array); return 0; }