c语言函数传值和址的问题

img


这个为啥运行不了报错,是不是函数传值和传址那里的问题,应该怎么修改呢?题目是求一个二维数组中的最大值,用擂台法并且输出结果和行列。

#include<stdio.h>
int cmp(int x,int y){
     int z;
     if(x>y)
         z=x;
      else
      return z;
  }
int main(){
     int a[2][3];
     int row, colum,n;
     for(row = 0;row < 2;row++)
          for (colum = 0; colum < 3; colum++)
              scanf("%d",&a[row][colum]);
     int max = a[0][0];
     for(row=0;row<2;row++){
         for (colum = 0; colum < 3; colum++){
             max = cmp(a[row][colum],max);
         }
     }
      printf("%d", max);
     return 0;
 }

img