Is there anything you could supply to the atoi function that would produce an error (that may or may not crash the program)?
EDIT: An error is defined as anything that would produce a compilation error, or something that would cause the program to terminate during execution.
anything that would produce a compilation error
If the argument you supply to atoi()
is of an incompatible type, you'll get a compile-time error.
something that would cause the program to terminate during execution
If you supply atoi()
with an invalid const char*
pointer, the behaviour of your code will be undefined. While nothing is guaranteed, if the pointer is NULL
or points to unreadable memory the program will likely terminate (this depends on the OS and the hardware architecture).