谁知道哪里错了怎么改
c语言吧
全部回复
仅看楼主
level 1
975422789 楼主
#include<stdio.h>
int sum; void main()
{
int f(int x, int y);
int x,y;
scanf("%d,%d",&x,&y);
sum=f(x,y);
printf("sum=%d\n",sum);
}
void f(int x,int y)
{
sum=x+y;
return sum;
}
2012年11月29日 09点11分 1
level 7
输入的格式,%d之间最好不要有逗号
2012年11月29日 09点11分 2
level 6
本人小白,但是试了下可以运行…有错吗
2012年11月29日 09点11分 3
level 6
你的定义错了,前面声明和使用明显都要求int返回值,可是却定义了void
2012年11月29日 09点11分 7
level 6
另外你变量使用混乱,sum在main里也用,f里也用,还是一条语句同时用!
2012年11月29日 09点11分 8
level 9
听楼上的话把void改成int吧,那就没错了。
趁机吐槽我讨厌自己现在的级别什么“低能力者”,活像……不说了,刷分努力快点升级,不然看着它闹心……
2012年11月29日 09点11分 9
level 11
sum这个变量弄的太混乱
2012年11月29日 09点11分 10
1