Yes. And the main problem of atoi() in my opinion is the absence of error checking both for overflow situations, but also regarding the contents of the string.
It stops at the first non numeric character and returns an int. Seems simple but it's actually a quiet strange function:
There's no error with the third atoi() call. But it poses a serious problem... there's no user-made error checking possible when the atoi parameter can be 0.Code:int foo = atoi("643bar") // returns 643. No error checking.
int foo = atoi("bar") // return 0(!!). No error checking.
int foo = atoi("0") // obviously returns 0 too.