Microsoft interview question

Implement atoi which converts a string to an integer.