Implement ATOI (C++)

An interview question I have been asked a good number of times is to Implement ATOI (convert a string to an integer). You can start off really simple and loop through a string, but you need to be able to catch negatives and then handle the case that the string passed is invalid NULL or contains non-numeric characters). The following implementation handles these cases. The point though in the end is to understand the question and build off of it. My philosophy in an interview is to start off simple and build on top. Trying to think of everything at…
Read more