ds6878恢复出厂设置:我是新手,帮忙看看错在哪了?急切等待中..... 谢谢啦!!!

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 10:57:07
main()
{
long a,b,c,d;
printf("please input three number,\n");
scanf("%ld,%ld,%ld",&a,&b,&c);
d=max(a,b,c);
printf("d is %ld",d);
getch();
}

long max(long x,long y,long z)
{
long v;
if(x>y) v=x;
else v=y;
if(v>z) return(v);
else return(z);
}
提示的是:
error:Type mismatch in redeclaration of 'max'

在main()前面加上
#include <stdio.h>

再试试

建议不要用long,你只是要比较三个数的大小,没有必要用这么长的数据,这样会减慢程序运行速度.用int完全够了.

我实现没看出有什么语法或逻辑错误
有出错提示吗
使用getch()要#include <conio.h>

头文件应该是#include<stdio.h>