How does atoi() function in C++ work?

前端 未结 6 617
旧时难觅i
旧时难觅i 2020-12-15 20:07

So...I know that the atoi function in the C++ standard library is supposed to convert a string into an integer...how does it work?...(I\'m trying to learn stuff and I was ju

6条回答
  •  粉色の甜心
    2020-12-15 20:39

    The logic is simply to process each character into it's integer value (adjusting for position within the string).

    Here's how I did it in C#. Same general idea.

提交回复
热议问题