为什么不对呢
#include <stdio.h>
#define N 10
void MAX(int score[])
{
int max=score[0];
for(int i=1;i<N;i++)
{
if(max<score[i])
max=score[i];
}
printf("最大值为%d\n",max);
}
void MIN(int score[])
{
int min=score[0];
for(int i=1;i<N;i++)
{
if(min>score[i])
min=score[i];
}
printf("最小值为%d\n",min);
}
void SA(int score[])
{
int sum=0;
for(int i=0;i<N;i++)
{sum+=score[i];}
printf("总分为%d\n",sum);
printf("均分为%d\n",sum/N);
}
void WANG(int score[])
{
int i,j,temp;
for(i=N-1;i>=0;i--)
{for(j=0;j<i;j++)
if(score[j]<score[j+1])
temp=score[j];
score[j]=score[j+1];
score[j+1]=temp;
}
for(int k=0;k<N;k++)
printf("%d",score[k]);
}
int main()
{
int score[N]={67,98,75,63,82,79,81,91,66,84};
MAX(score);
MIN(score);
SA(score);
WANG(score);
return 0;
}
错误的代码是
/bin/bash: line 1: 18563 Segmentation fault (core dumped) hello 最大值为98