输出二维数组各元素的值第二版

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     void output(int(*p)[4]);
 7     int a[3][4]={1,3,5,7,8,9,12,14,15,32,11,14};
 8     output(a);
 9     return 0;
10 }
11 
12 void output(int(*p)[4]){
13     int i,j;
14     for(i=0;i<3;i++)
15     for(j=0;j<4;j++)
16     cout<<*(*(p+i)+j)<<" ";
17     cout<<endl;
18 }

 

posted @ 2018-08-01 15:28  borter  阅读(124)  评论(0编辑  收藏  举报