为什么函数体一直提示错误,就swap和exchange
#include <stdio.h>#include<string.h>
#include <stdlib.h>
int stu_ID[3]={1001,1002,1003};
int stu_class[3]={11,22,11};
float stu_score [3][3]={{99.5,88.5,89.5},{77.9,56.5,87.5},{92.5,99.0,60.5}};
char stu_name[3][10]={"zhang","li","wang"};
float stu_sum[3];
int main()
{
int i,j;
void add(float b[3][3]);
void sort(float a[3]);
void exchange(int,int);
void swap(int,int);
add(stu_score);
sort(stu_sum);
for(i=0;i<3;i++)
{printf("%d,%d,%s,",stu_ID[i],stu_class[i],stu_name[i]);
for(j=0;j<3;j++)
{printf("%3.1f,",stu_score[i][j]); }
printf("%4.1f\n",stu_sum[i]);
}
return 0;
}
void add(float b[3][3])
{ int i,j;
float stu_sum[3]={0};
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{stu_sum[i]+=b[i][j];}
}
void sort(float a[3])
{
int i,j;
for(i=0;i<2;i++)
for(j=0;j<2-i;j++)
{
if(a[j]<a[j+1])
{
exchange(j,j+1);
swap(j,j+1);
}
}
}
void exchange(int i,int j)
{
int t;
float temp;
t=stu_class[i];stu_class[i]=stu_class[j];stu_class[j]=t;
t=stu_ID[i];stu_ID[i]=stu_ID[j];stu_ID[j]=t;
for(t=0;t<3;t++)
{temp=stu_score[i][t];stu_score[i][t]=stu_score[j][t];stu_score[j][t]=temp;}
}
void swap(int i,int j)
{
char n[10];
strcpy(n,stu_name[i]);strcpy(stu_name[i],stu_name[i+1]);strcpy(stu_name[i+1],n);
}