`atoi`的名字来自哪里?

问题描述 投票:70回答:2

在C语言中,他们提出了将字符串转换为整数的名称atoi吗?我唯一能想到的是Array To Integer的首字母缩略词,但这并没有多大意义。

c naming-conventions atoi
2个回答
127
投票

这意味着Ascii到整数。同样,你可以有Ascii到long的atol,用于Ascii到Float的atof等。

A Google search for 'atoi "ascii to integer"'在几页上证实了这一点。

我很难找到任何官方消息来源......但是在丹尼斯·里奇本人收集的this listing of man pagesThird Edition Unix (1973)中,它确实包含以下内容:

atoi(III): convert ASCII to integer

事实上,即使是first edition Unix (ca 1971)手册list atoi as meaning Ascii to Integer

因此,即使没有任何文档比官方页面更正式表明atoi意味着Ascii到Integer(我怀疑存在而且我只是无法找到它),所以至少自1971年以来,它已经按照惯例进行了Ascii to Integer 。


-1
投票

我悲伤地认为函数atoi意味着ascii到整数。

© www.soinside.com 2019 - 2024. All rights reserved.