遍历二维数组a[3][4]的元素并打印出来,a[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}} ,要求用指针遍历.

如题所述

第1个回答  2017-06-18
#include <stdio.h> void main() { int i,j,row = 0 ,colum = 0,max; int a[3][4]={{1,2,3,4},{9,8,7,6},{-10,10,-5,2}}; max = a[0][0]; for(i=0;i<=2;i++) for(j=0;j<=3;j++) if(a[i][j]>max) { max = a[i][j]; row = i; colum = j; } printf("max=%d,/nrow = %d,/ncolum = %d/n",max,row,colum); }
相似回答