新手刚学C语言,求教各位前辈
按照老师视频中,照抄如下语句:#include<stdio.h>
int max(int a,int b); /*函数说明*/
void main() /*主函数*/
{
int x,y,z; /*变量说明*/
int max(int a,int b); /*函数说明*/
printf("input two numbers:\n");
scanf("%d%d",&x,&y); /*输入x,y值*/
z = max(x,y);
printf("maxnum=%d",2); /*输出*/
return;
}
{
int max(int a,int b); /*定义max函数*/
if(a>b);return a;else:return b; /*把结果返回主调函数*/
}
编译时提示有一个错误:error C2447: missing function header (old-style formal list?),光标在倒数第三行,请问如何修改这个错误,谢谢! #include<stdio.h>
int max(int a,int b); /*????*/
void main() /*???*/
{
int x,y,z; /*????*/
printf("input two numbers:\n");
scanf("%d %d",&x,&y); /*??x,y?*/
z = max(x,y);
printf("maxnum=%d",z); /*??*/
return;
}
int max(int a,int b)
{
if(a>b) return a; else return b; /*?????????*/
}
注释乱码了,因为我用的Dev-C++ 谢谢楼上两位,我知道错在哪里了。原来是 int max(int a,int b) 这一句前后用了两次
页:
[1]