这条C语言语句,哪里有错啊?

来源:百度知道 编辑:UC知道 时间:2024/06/19 09:25:09
#include<stdio.h>
main()
{
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}
整个语句都在这里了,可是按ctrl+F9,就提示错误..

应该把a,b赋值吗??怎么写这个才能运行啊?

undefined symbol ''_max'' in module
没有定义的符号max
改正方式:
#include<stdio.h>
#define max(a,b) a>b?a:b
main()
{
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}

返回值,return 0;

要不你就用void main(),但是不建议这样

错误很多,max函数没有被定义
a,b都没有被赋值,无法比较
c=max(a,b)//这句错了。

max函数为math.h中的库函数,需要在前面加上#include<math.h>。
#include<stdio.h>
#include<math.h>
main()
{
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}

没有错,是不是MAX函数你没有写?

嗯 max函数从那来的 错误提示你看不懂吗