views:

281

answers:

2

Ok I've been curious about this for a while. In the C language where did they come up with the name atoi for converting a string to an integer? The only thing I can think of is Array To Integer for an acronym but that doesn't really make sense.

+22  A: 

It means Ascii to Integer. Likewise, you can have atol for Ascii to Long, atof for Ascii to Float, etc.

A Google search for 'atoi "ascii to integer"' confirms this on several pages.

I'm having trouble finding any official source on it... but in this listing of man pages from Third Edition Unix (1973) collected by Dennis Ritchie himself, it does contain the line:

atoi(III): convert ASCII to integer

In fact, even the first edition Unix (ca 1971) man pages list atoi as meaning Ascii to Integer.

So even if there isn't any documentation more official than man pages indicating that atoi means Ascii to Integer (I suspect there is and I just haven't been able to locate it), it's been Ascii to Integer by convention at least since 1971.

Mark Rushakoff
Ah of course a non-standard acronym `AsciiTOInteger`. Who names these things!? Even worse is there is no standard `itoa` function for the reverse, only `sprintf`
Earlz
Does the 1979 Version 7 Unix Manual count as an official source? http://cm.bell-labs.com/7thEdMan/vol1/man3.bun
msw
I guess the man pages are as official as it gets. I was expecting it to be declared in one of the standards, at least, but it's not in the C99 draft standard that I have...
Mark Rushakoff
Great detective work.
Norman Ramsey
@Earlz - These things were named when linkers supported only six significant characters per identifier. Go read your history and be not so snarky.
Heath Hunnicutt
+10  A: 

ASCII to integer

misterMatt