Re: Unexpected behavior of atoi() function.
atoi(...) is Not a function specified in C standardization documents.
It is a common name of INTERNAL tool within C compiler implementation.
As such, it may behave differently in different compiler libraries, with different compiler implementations,
or with different compiler versions.
It may also be integrating with other functions in the compiler library, in a way that is internal to the library implementation.
Compiler Library implementers, may do anything they want with atoi(...) and similar functions,
including specifying it as static ( that means: internal, private).
If atoi(...); function is specified with argument list in library documentation belonging to the compiler implementation and version in use, then it may be used as specified.
If this is Not the case, then you are operating Outside of Specifications.