C语言问题

#include "stdio.h"
#include "stdlib.h"
#include "time.h"
int max(int a,int b,int c)
{
int d;
if(a>b) d=a;
else d=b;
if(d>c) d=d;
else d=c;
return (d);
}
main()
{
int x,y,z,o;
srand(time(NULL));
x=rand()%100;
y=rand()%100;
z=rand()%100;
printf("语文为:%d 数学为:%d 英语为:%d",x,y,z);
o=max(x,y,z);
printf("%d",o);
}
请问这个程序哪里错了 为什么提示错误warning C4002: too many actual parameters for macro 'max'
G:\hhhh.c(4) : error C2059: syntax error : 'type'
G:\hhhh.c(21) : warning C4002: too many actual parameters for macro 'max'
这是什么原因!!!!!!!!

第1个回答  2012-04-16
too many actual parameters for macro 'max'
宏 max 的实际参数太多
看样子你包含的某个文件中已经定义了一个宏 max,与你的 max 函数冲突了。
试试将 max 函数改名,调用的地方也改名。本回答被网友采纳
第2个回答  2012-04-15
直接贴代码了我
#include "stdlib.h"
#include“stdio.h”
#include "time.h"
int max(int a,int b,int c)
{
int d;
if(a>b) d=a;
else d=b;
if(d>c) d=d;
else d=c;
return (d);
}
int main()
{
int x,y,z,o;
srand(time(NULL));
x=rand()%100;
y=rand()%100;
z=rand()%100;
printf("语文为:%d 数学为:%d 英语为:%d",x,y,z);
o=max(x,y,z);
printf("%d",o);
return 0;
}
第3个回答  推荐于2018-03-22
改一下名字,不要用max
比如改成mymax
因为max是系统的一个宏。本回答被网友采纳
第4个回答  2012-04-15
运行完全正确,但是建议把main函数定义为int型,你那样是不标准的.
第5个回答  2012-04-15
经VC 6.0调试没有错误。
相似回答