分享
#include <stdio.h>int main()
{
int max(int x,int y);
int a,b,c;
printf("Please input a and b:");
scanf("%d%d",&a,&b);
c = max(a,b);
printf("The max number is :%d\n",c);
}
int max(int x,int y)
{
int z;
z = x > y? x:y;
return(z);
} 楼主,下面这一句多余:
int max(int x,int y);
如果把 max() 的函数定义移动到 main() 的前面,那就无需声明,可以直接调用:
#include <stdio.h>
int max(int x,int y)
{
int z;
z = x > y? x:y;
return(z);
}
int main()
{
int a,b,c;
printf("Please input a and b:");
scanf("%d%d",&a,&b);
c = max(a,b);
printf("The max number is :%d\n",c);
} jackz007 发表于 2019-10-28 10:50
楼主,下面这一句多余:
int max(int x,int y);
好的,谢谢您!
页:
[1]