C语言函数声明与函数定义的问题?

在如果求a个学生b门功课的平均成绩时,程序如下:

#include <stdio.h>
void cour_ave(int a,int b,float score[])/*函数定义*/
{
int course,stud;
float total1,aver1;
for(course=0;course<b;course++)
{
total1=0;
for(stud=0;stud<a;stud++)
total1=total1+score[stud*b+course];
aver1=total1/a;
printf("average of course %d is:%6.2f\n",course,aver1);
}
return;
}
void stud_ave(int a,int b,float score[])/*函数定义*/
{
int course,stud;
float total2,aver2;
for(stud=0;stud<a;stud++)
{
total2=0;
for(course=0;course<b;course++)
total2=total2+score[stud*b+course];
aver2=total2/b;
printf("average of student %d is:%6.2f\n",stud,aver2);
}
return;
}

#define a 4
#define b 3
main()
{
void cour_ave(int x,int y,float score[]);/*函数声明*/
void stud_ave(int x,int y,float score[]);/*函数声明*/
float score[a][b]={{89,78,56},{88,99,100},{72,80,61},{60,70,75}};
cour_ave(a,b,score);/*执行函数功能*/
stud_ave(a,b,score);/*执行函数功能*/
}

按照我的理解,函数声明和函数定义的语句应当是一样的,可是以上程序却使用了不同的形参字母,但执行没有错误。请高手帮我分析一下...

函数的形参字母在声明的时候是可以省略的,话句话说声明函数形参时,只需要说明类型就行了
所以说,如果函数定义中的形参字母有所变化是不影响的。只要类型相同就行。
温馨提示:答案为网友推荐,仅供参考
相似回答