你#include <stdio.h>了吗。
网上论坛: http://groups.google.com/group/learning-linux-c-cpp/topics
- 自学linux C菜鸟,想知道这个是怎么错了 [4 条更新]
清源 <olu...@gmail.com> Apr 26 10:48PM -0700
int factorial(int n)
{
int result = 1;
int i;
for(i = 1; i <= n; i++)
result = result * i;
return result;
}
int scan(void)
{
printf("Input Number");
scanf("%d",&n);
return n;
}
int main()
{
int k=scan(), l=factorial(k);
printf("%d",l);
return 0;
}
"TyumenDrink" <8277...@qq.com> Apr 27 05:18PM +0800
第二个函数的变量n没有定义
------------------
杜裕敬呈
------------------ 原始邮件 ------------------
发件人: "清源";<olu...@gmail.com>;
发送时间: 2014年4月27日(星期天) 中午1:48
收件人: "learning-linux-c-cpp"<learning-l...@googlegroups.com>;
主题: [learn-linux-c-cpp] 自学linux C菜鸟,想知道这个是怎么错了
int factorial(int n)
{
int result = 1;
int i;
for(i = 1; i <= n; i++)
result = result * i;
return result;
}
int scan(void)
{
printf("Input Number");
scanf("%d",&n);
return n;
}
int main()
{
int k=scan(), l=factorial(k);
printf("%d",l);
return 0;
}
--
您收到此邮件是因为您订阅了Google网上论坛中的“Linux C/C++/系统编程 一站式学习”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到learning-linux-c...@googlegroups.com。
要查看更多选项,请访问https://groups.google.com/d/optout。
隆多多 <olu...@gmail.com> Apr 27 07:16PM +0800
test2.c: In function ‘scan’:
test2.c:12:2: warning: incompatible implicit declaration of built-in
function ‘printf’ [enabled by default]
printf("Input Number");
^
test2.c:13:2: warning: incompatible implicit declaration of built-in
function ‘scanf’ [enabled by default]
scanf("%d",&n);
^
test2.c: In function ‘main’:
test2.c:19:2: warning: incompatible implicit declaration of built-in
function ‘printf’ [enabled by default]
printf("%d",l);
^
重新定义了N 之后依然报错,看返回信息依然不知道错在那里
在 14/4/27,TyumenDrink<8277...@qq.com> 写道:
Ivan Zhou <13584...@163.com> Apr 27 09:47PM +0800
--
#include -- 发自 Android 网易邮箱 在2014年04月27日 19:16, 隆多多写道: test2.c: In function ‘scan’: test2.c:12:2: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default] printf("Input Number"); ^ test2.c:13:2: warning: incompatible implicit declaration of built-in function ‘scanf’ [enabled by default] scanf("%d",&n); ^ test2.c: In function ‘main’: test2.c:19:2: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default] printf("%d",l); ^ 重新定义了N 之后依然报错,看返回信息依然不知道错在那里 在 14/4/27,TyumenDrink<8277...@qq.com> 写道: > 第二个函数的变量n没有定义 > > > ------------------ > 杜裕敬呈 > > > > > > > > ------------------ 原始邮件 ------------------ > 发件人: "清源";<olu...@gmail.com>; > 发送时间: 2014年4月27日(星期天) 中午1:48 > 收件人: "learning-linux-c-cpp"<learning-l...@googlegroups.com>; > > 主题: [learn-linux-c-cpp] 自学linux C菜鸟,想知道这个是怎么错了 > > > > int factorial(int n) > { > int result = 1; > int i; > for(i = 1; i <= n; i++) > result = result * i; > return result; > } > int scan(void) > { > printf("Input Number"); > scanf("%d",&n); > return n; > } > int main() > { > int k=scan(), l=factorial(k); > printf("%d",l); > return 0; > } > > > > > > > -- > 您收到此邮件是因为您订阅了Google网上论坛中的“Linux C/C++/系统编程 一站式学习”论坛。 > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到learning-linux-c...@googlegroups.com。 > 要查看更多选项,请访问https:// groups.google.com/d/optout。 > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛“Linux C/C++/系统编程 一站式学习”中的主题。 > 要退订此主题,请访问https:// groups.google.com/d/topic/learning-linux-c-cpp/ktcwR-NYX58/unsubscribe。 > 要退订此论坛及其所有主题,请发送电子邮件到learning-linux-c...@googlegroups.com。 > 要查看更多选项,请访问 https://groups.google.com/d/optout。 > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“Linux C/C++/系统编程 一站式学习”论坛。 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到learning-linux-c...@googlegroups.com。 要查看更多选项,请访问 https://groups.google.com/d/optout。
您收到此邮件是因为您订阅了Google网上论坛中的“Linux C/C++/系统编程 一站式学习”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到learning-linux-c...@googlegroups.com。
要查看更多选项,请访问https://groups.google.com/d/optout。