c语言实现用指针遍历二维数组

 1 #include <stdio.h>
 2 void bian(int row,int col,int *a)
 3 {
 4     int i,j;
 5     for(i=0;i<row;i++)
 6         for(j=0;j<col;j++)
 7             printf("%d  ",*(a+col*i+j));
 8 }
 9 int main()
10 {
11     int a[3][4]={34,45,6,67,453,456,4,34,56,67,345};
12     bian(3,4,a);
13 }

猜你喜欢

转载自www.cnblogs.com/lqboke/p/9905555.html