感受指针之美
#include<stdio.h>#define N 3
#define M 3
int select (int a,int *n)
{
int i,j,row = 1,colum = 1;
for(i = 0;i < N;i++)
{
for (j = 0;j < M;j++)
{
if(a > a)
{
row = i;
colum = j ;
}
}
}
*n = row ;
return a;
}
int main()
{
int a = {9,11,23,6,1,15,9,17,20},max,n;
max = select(a,&n);
printf("max = %d,line = %d\n",max,n);
return 0;
}
6
页:
[1]