函数名称atoi [英] Name of the function atoi

查看:101
本文介绍了函数名称atoi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


出于好奇-当atoi函数将字符转换为整数,即转换为其数字表示形式,换句话说转换为其ASCII值时,为什么函数名atoi(将ASCII转换为整数)?

函数悖论的名称不是吗?

谢谢
Harish

Hi,
Just out of curiosity - When the function atoi is converting character to integer i.e. to its numerical representation, in other words to its ASCII value, why is the function name atoi (ASCII to integer)?

Isn’t the name of function paradox?

Thank you,
Harish

推荐答案

否,此函数的作用非常不同.看看它的个人资料:

No, this function does something very different. Just look at it''s profile:

int atoi ( const char * str );



并查看其文档: http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/ [ ^ ].

严格来说,它甚至不转换任何内容.假设该字符串是代表整数值的字符串,它会尝试解析以空值结尾的字符串,然后返回该值.

—SA



and also see its documentation: http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/[^].

It does not even convert anything, strictly speaking. It attempts to parse a null-terminated string assuming this is a string representing integer value and returns this value.

—SA


这篇关于函数名称atoi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆