首页 > 系统服务 > 详细

Ubuntu下int转字符串

时间:2017-07-11 17:41:31      阅读:292      评论:0      收藏:0      [点我收藏+]
# include <stdio.h>
# include <stdlib.h>
void main (void)
{
int num = 100;
char str[25];
sprintf(str,"%d",num);
printf("The number ‘num‘ is %d and the string ‘str‘ is %s. \n" ,num, str);
}

在Linux系统中并不支持itoa()和ltoa(),它们并不是C的标准库函数,只能在windows下使用。

● itoa():将整型值转换为字符串。
● ltoa():将长整型值转换为字符串。

本文出自 “帆布鞋也能走猫步” 博客,请务必保留此出处http://9409270.blog.51cto.com/9399270/1946387

Ubuntu下int转字符串

原文:http://9409270.blog.51cto.com/9399270/1946387

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!