Difference between atoi and stoi

What is the difference between atoi and stoi?
Basically the C function atoi() converts C-strings (nul terminated character arrays) to an integer. The C++ stoi() converts the C++ string to an integer. Note that the atoi() function will silently fail if the string is not convertible to an int, while by default stoi() will throw an exception.

Topic archived. No new replies allowed.