为什么max永远指向num的第一项?
#include <stdio.h>#include <stdlib.h>
#define N 80
int FideMax(int score[],long num[],int n,long *pMaxNum);
int main()
{
int n,i,score[N],j;
long num[N],*Max=num;
printf("input how many people:\n");
scanf("%d",&n);
printf("input grade and ID :\n");
for(i=0;i<n;i++)
scanf("%d%ld",&score[i],&num[i]);
j=FideMax(score,num,n,Max);
printf("MAx=%d ID=%ld",j,*Max);
return 0;
}
int FideMax(int score[],long num[],int n,long *pMaxNum)
{
int pos,i;
pos=score[0];
for(i=0;i<n;i++)
{
if(pos<score[i])
{
pos=score[i];
pMaxNum=num+i;
printf("%ld\n",*pMaxNum);
}
}
return pos;
}