 <p>From the following somewhat arbitrarily found man page for atoi....</p> <p><a href="http://linux.die.net/man/3/atoi" rel="nofollow">http://linux.die.net/man/3/atoi</a></p> <p>*<em>The atoi() function converts the initial portion of the string pointed to by nptr to int. *</em></p> <p>In short, the function is working exactly as it is defined.</p>