#include <stdio.h>
#define N 80
void FindMax(int score,long num,int n,int *pMaxScore,long *pMaxNum);
int main()
{
long num[N];
long maxNum;
//long *maxNum;
int score[N];
int maxScore;
//int *maxScore;
int n,i;
printf("input students numbers:");
scanf("%d",n);
for(i=0;i<n;i++)
{
printf("input scores and num:");
scanf("%d%d",&score,&num);
}
FindMax(score,num,n,&maxScore,&maxNum);
printf("maxScore = %d,maxNum = %ld",maxScore,maxNum);
}
void FindMax(int score[],long num[],int n,int *pMaxScore,long *pMaxNum)
{
int i;
*pMaxScore = score[0];
*pMaxNum = num[0];
for(i=0;i<n;i++)
{
if(*pMaxScore<score[i])
{
*pMaxScore = score[i];
*pMaxNum = num [i];
}
}
printf("*pMaxScore = %d,*pMaxNum = &ld",pMaxScore,pMaxNum);
}
刚刚学习函数与指针,不太懂,求大神指教