黯落辰星 2022-05-18 11:10 采纳率: 85%
浏览 1275
已结题

查找二维数组中的最大值及其行列下标

#include <stdio.h>
#define ROW 3
#define COL 4
int FindMaxbyCol(int *q,int row,int col,int *maxRow,int *maxCcol);
int main(void)
{
int a[ROW][COL];
int max,maxr,maxc;
int i,j;

for(i=0;i<ROW;i++)
{
    for(j=0;j<COL;j++)
        scanf("%d",&a[i][j]);   
}

2 分

printf("max=%d  maxr=%d   maxc=%d\n",max,maxr,maxc);
return 0;

}
int FindMaxbyCol(int *q,int row,int col,int *maxRow,int *maxCcol)
{
int i,j;
int max;
2 分

*maxRow=0;
*maxCcol=0;
for(i=0;i<row;i++)
{
    for(j=0;j<col;j++)
    {
        if(2

)
{
2 分

            *maxRow=i;
            *maxCcol=j;
        }
    }
}

2 分

}

  • 写回答

2条回答 默认 最新

  • 关注

    max=FindMaxbyCol(a[0],ROW,COL,&maxr,&maxc);
    max=q[0];
    q[i * col+j]>max
    max=q[i * col+j];
    return max;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 5月26日
  • 已采纳回答 5月18日
  • 创建了问题 5月18日