//proto.c--使用函数原型
#include <stdio.h>
int imax(int, int);//旧式函数声明
int main(void)
{
printf("The maximum of %d and %d is %d.\n", 3, 5, imax(3));
printf("The maximum of %d and %d is %d.\n", 3, 5, imax(3.0, 5.0));
return 0;
}
int imax(int n,int m)
{
return(n>m?n:m);
}
修改后代码:
//proto.c--使用函数原型
#include <stdio.h>
int imax(int, int);//旧式函数声明
int main(void)
{
printf("The maximum of %d and %d is %d.\n",
3, 5, imax(3,5)); //imax(3)-->imax(3, 5)
printf("The maximum of %d and %d is %d.\n", 3, 5, imax(3.0, 5.0));
return 0;
}
int imax(int n,int m)
{
return(n>m?n:m);
}