|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
main(),
{
int a,b,sum;
printf("please input two numbers:\n");
scanf("%d%d",&a,&b);
sum=add(a,b);
printf("%d+%d=%d",a,b,sum);
}
int add(int a,int b)
{
int c;
c=a+b;
return c;
}
错误码:
[Warning] data definition has no type or storage class
[Error] expected identifier or '(' before '{' token
recipe for target 'main.o' failed
add函数应该放在main函数前面
- #include <stdio.h>
- int add(int a, int b)
- {
- int c;
- c = a + b;
- return c;
- }
- int main(void)
- {
- int a, b, sum;
- printf("please input two numbers:\n");
- scanf("%d%d",&a,&b);
- sum = add(a, b);
- printf("%d + %d = %d\n", a, b, sum);
-
- return 0;
- }
复制代码
|
|