为什么使用c99标准,就显示warning: implicit declaration of function 'itoa'|

test_lockxxx 2012-03-02 12:09:17
写java程序的时候,比如一个循环例子:

for(int i=0;i<10;i++)
{
....
}

我用c程序写的时候

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

for(int i=0;i<10;i++)
{
;
}
编译的时候,提示: -std=c99

我加上这句后,再编译,通过了。
但是显示: warning: implicit declaration of function 'itoa'|


我上面已经加了:#include <stdlib.h>
为什么会显示: warning: implicit declaration of function 'itoa'|

我平时使用的是 CodeBlocks 练习 c
...全文
6730 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
test_lockxxx 2012-03-02
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 mingtianhejintian4 的回复:]
引用 3 楼 test_lockxxx 的回复:
有没有与itoa功能类似的标准c函数?

没有,假如你使用C99标准,那么今后你会遇到更多的麻烦,而且程序很难移植,兼容性差,大部分编译器看不懂你的代码,总之麻烦很多,以后你可能要重新按C89标准来写。先做好准备吧。
[/Quote]

您的意思是,以后用c写程序,最好使用 c89标准,不要使用 c99标准,对吗?
test_lockxxx 2012-03-02
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 mingtianhejintian4 的回复:]
这个你都不知道啊,itoa不是标准函数 !
[/Quote]

让你见笑了,我是C菜鸟,发自内心的喜欢c,但平时工作极少用,就是有空时练习一下c。
大部分工作时间还是用java开发。
test_lockxxx 2012-03-02
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 lactoferrin 的回复:]
sprintf
[/Quote]

int main()
{

char str[10];

long x = 1234567890L;

sprintf(str,"%ld",x);

printf("%s",str);

return 0;
}

试了一下 sprintf 原来挺方便的。
mingtianhejintian4 2012-03-02
  • 打赏
  • 举报
回复
另外CodeBlocks在Windows下也不是完全支持C99标准,现在完全支持C99标准的编译器你都见不到,都在一些基本见不到的操作系统上使用,比如IBM的操作系统上,不知道你是做什么的??
mingtianhejintian4 2012-03-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 test_lockxxx 的回复:]
有没有与itoa功能类似的标准c函数?
[/Quote]
没有,假如你使用C99标准,那么今后你会遇到更多的麻烦,而且程序很难移植,兼容性差,大部分编译器看不懂你的代码,总之麻烦很多,以后你可能要重新按C89标准来写。先做好准备吧。
mingtianhejintian4 2012-03-02
  • 打赏
  • 举报
回复
这个你都不知道啊,itoa不是标准函数 !
Lactoferrin 2012-03-02
  • 打赏
  • 举报
回复
sprintf
test_lockxxx 2012-03-02
  • 打赏
  • 举报
回复
有没有与itoa功能类似的标准c函数?
Lactoferrin 2012-03-02
  • 打赏
  • 举报
回复
itoa不是标准c函数
test_lockxxx 2012-03-02
  • 打赏
  • 举报
回复
如果我去掉: -std=c99 这一句,就不会报:
warning: implicit declaration of function 'itoa'|

70,017

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧