c取出数组中的值,和所在的行和列

/*
get the max value from array
*/
#include<stdio.h>

main()
{
  int i,j,row=0,colum=0,max=0;
  static int a[3][4]={{5,3,9,34},{24,20,11,39},{-12,23,65,29}};
  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("the value's row is %d,colum is %d\n",i,j);
      }
     // printf("the value's row is %d,colum is %d\n",i,j);
    }
  }
  printf("the max value is %d\n",max);
  //printf("the value's row is %d,colum is %d\n",i,j);
  return 0;
}
原文地址:https://www.cnblogs.com/zhaozhilu/p/2799190.html