请大家帮我改一下这个程序 似乎是fun函数错了
利用结构体的指针形式来求数组的最大值(求结构体中s的最大值)似乎是fun函数错了
#include <stdio.h>
#include <string.h>
#define N 10
typedef struct ss
{ char num[10];
int s;
} STU;
void fun(STU a[],STU *s)
{
int temp;
s=temp;
temp=a;
for(;temp<a+10;temp++)
if(a[temp].s>a[temp+1].s)
return a[temp+1].s;
else return a[temp].s;
}
main ( )
{ STU a[N]={ {"A01",81},{"A02",89},{"A03",66},{"A04",87},{"A05",77},
{"A06",90},{"A07",79},{"A08",61},{"A09",80},{"A10",71} }, m;
int i;
printf("***** The original data *****\n");
for (i=0;i<N;i++)printf("No=%s Mark =%d\n",a[i].num,a[i].s);
fun (a,&m );
printf ("***** THE RESULT *****\n");
printf ("The lowest:%s,%d\n",m.num,m.s);
}