c语言两数之间求最大值

#include

int main()
{
int max(int x, int y);

int a,b,c;

scanf("%d,%d",&a,&b);

c=max(a,b);

printf("max= %d\n",c);

return 0;

}

这个为什么运行的时候显示“undefined reference to 'max'”,大佬求救

img

你的max函数没有定义吧?

#include <stdio.h>
int main(){
int max(int a,int b);
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max= %d\n",c);
return 0;
}
int max(int a,int b){
return a>b? a:b;
}

有帮助的话采纳一下哦!

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^