22行删掉
x,y是参数变量,你不能又定义同名的局部变量啊
另外,max函数只有两个参数,你调用传递了3个参数啦
调用的地方改为:
d = max(a,b);
d = max(d,c);
#include <stdio.h>
int max(int x,int y);
int main()
{
int a,b,c,d;
scanf("%d%d%d",&a,&b,&c);
d = max(a,b);
d = max(d,c);
printf("max=%d\n",d);
return 0;
}
int max(int x,int y)
{
if(x>y)
return x;
return y;
}
#include <stdio.h>
int max(int a, int b) {
if (a > b)
return a;
else
return b;
}
int main() {
int a, b, c, d;
scanf("%d,%d,%d", &a, &b, &c);
d = max(max(a, b), c);
printf("%d\n", d);
return 0;
}
你的max有问题,
max一次只能传入2个参数
你可以这么写d=max(max(a,b),c);
感谢各位大老