#include<stdio.h>标签:print1,arr,print2,int,打印,++,二维,数组,printf From: https://blog.51cto.com/u_13606048/6114283
void print1(int arr[3][5], int x, int y) {//传统打印方式
int i = 0;
for (i = 0; i < x; i++) {
int j = 0;
for (j = 0; j < y; j++) {
printf("%d", arr[i][j]);
}
printf("\n");
}
}
void print2(int(*arr)[5], int x, int y) {//数组指针的运用
int i = 0;
for (i = 0; i < x; i++) {
int j = 0;
for (j = 0; j < y; j++) {
printf("%d", *(*(arr + i) + j));
}
printf("\n");
}
}
int main() {
int arr[3][5] = { {1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7} };
print1(arr, 3, 5);
print2(arr, 3, 5);
return 0;
}