- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
c语言 itoa函数及atoi函数(C language, Itoa function and ATOI function)
c语言 itoa函数及atoi函数(C language, Itoa function and ATOI function)
C language Itoa function and ATOI function
The Itoa function and ATOI function
2007-05-11 13:52
The C language provides several standard library functions can be of any type (integer, long integer, floating point number is converted to a string etc.). The following is the use of Itoa () function converts an integer to a string of examples:
# include stdio.h
# include stdlib.h
Void main (void)
{
Int num = 100;
Char str[25];
Itoa (Num, STR, 10);
Printf (The numbernumis%d and the stringstr is%s. /n,
Num, STR);
}
Itoa () function has 3 parameters: the first parameter is the number to be converted, the second parameter is to write the target string conversion results, the third parameter is used to transfer digital time base. In this case, the conversion base 10. 10: 2: binary decimal...
The C function Itoa is not a standard, it is unique to the Windows. If you want to write cross platform program, please use the sprintf.
Is the Windows platform extension, sprintf standard library function, more than this, similar to printf:
Char str[255];
Sprintf (STR,%x, 100); / / 100 to 16 hexadecimal string representation.
The following functions can convert an integer into a string:
----------------------------------------------------------
The name of the function.
----------------------------------------------------------
(Itoa) the integer value into a string
(Itoa) the long integer value into a string
(ultoa) will be unsigned long integer value into a string
A ATOI convert a string of integers
Example program:
#include ctype.h
#include stdio.h
Int ATOI (char s[]);
Int main (void)
{
Char s[100];
Gets (s);
Printf (integer=%d/n, ATOI (s));
Return 0;
}
Int ATOI (char s[])
{
Int i, N, sign;
For (i=0; isspace (s[i]); / / i++) skip whitespace
;
Sign= (s[i]==-) -1:1?;
If (s[i]==+||s[i]==-) / skip symbol
I++;
For (n=0; isDigit; i++ (s[i]))
N=10*n+ (s[i]-0); / / digital characters into digital shaping
Return sign *n;
}
Two put
您可能关注的文档
- 90天司法考试复习方案(90 day judicial examination review program).doc
- 91-数学能力及培养(91- mathematical ability and training).doc
- 93分考研英语达人的阅读笔记(93 reading notes for English Majors).doc
- 93条重口味个性语录,句句经典(93 flavors, personal quotations, sentences classic).doc
- 94分 2011年度中小学教师中高级职称网络考试(94, 2011 primary and secondary school teachers, senior titles, network examination).doc
- 95-小学学习永威教学模式经验(转贴)(95- primary school learning Yong Wei experience in teaching mode).doc
- 98五笔教程(五笔字根表及口诀)(98 five pen tutorial (five etymon table and formula)).doc
- 98名学者提供意见积极应对2010年前后风险期(98 scholars advise to actively cope with the risk period before and after 2010).doc
- 995-临时聘-东胜区小学教师招聘考试音体美专业技能测试方案(995- temporary - Dongsheng District primary school teacher recruitment examination voice, body beauty professional skills test program).doc
- 99个使用频率较高的词语搭配(99 collocations with higher frequency).doc
- 2024年特岗教师能力提升B卷题库及完整答案详解【精选题】.docx
- 2024年特岗教师能力提升B卷题库及完整答案详解(典优).docx
- 2024年特岗教师能力提升B卷题库及完整答案详解【夺冠系列】.docx
- 2024年特岗教师能力提升B卷题库及完整答案详解【历年真题】.docx
- 2025年人力资源管理师薪酬效果评估薪酬效果与竞争应用实务.doc
- 2024年特岗教师能力提升B卷题库及完整答案详解(全优).docx
- 2024年特岗教师能力提升B卷题库及完整答案详解【各地真题】.docx
- 2024年特岗教师能力提升B卷题库及完整答案详解【典优】.docx
- 2024年特岗教师能力提升B卷题库及参考答案详解(轻巧夺冠).docx
- 2024年特岗教师能力提升B卷题库及参考答案详解(A卷).docx
最近下载
- 基于大模型的生成式检索.pdf VIP
- 西门子伺服操作说明书-SINAMICS_V90_OPI.pdf VIP
- 电力工程施工安全与质量控制管理.docx VIP
- Packing List-装箱单表格模板.xls VIP
- 电力工程施工安全及质量控制管理.doc VIP
- 2025年最新版硫化氢考试题库大全集.doc VIP
- [江西]发电厂2×600mw级机组“上大压小”土建工程施工组织设计.doc VIP
- 《护患沟通技巧》ppt课件.pptx VIP
- 县乡教师选调进城考试《教育心理学》题库及答案(各地真题).docx VIP
- 发电厂“上大压小”2×600MW超临界空冷机组工程土建专业主要施工方案.docx VIP
文档评论(0)