Difference between atoi and stoi

Sep 8, 2016 at 6:37am
What is the difference between atoi and stoi?
Sep 8, 2016 at 6:42am
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.

Sep 8, 2016 at 8:57am
Topic archived. No new replies allowed.