Convert string to integer.
'Atoi' stands for 'ascii to integer' and converts ASCII characters that represents the number to number that is an integer.
Example: '123' -> 123
Few important things you need to pay attention to when writing the algorithm:
When writing algorithm it is usually assumed that characters are ASCII characters. In this case characters that represent digits like '0', '1', '2', are consecutive characters, ex. ASCII value of '1' is just next to ASCII value of '1' and is exactly 1 more in value. This allows you to assume that you do not need to know explicit value of ASCII character '1', but you can convert it into value 1, by subtracting ASCII value of '1' from ASCII value of '0'. This is how algorithm is constructed.
Below are two different functions, first one - simple one that converts 'base 10' numbers; second - more complicated one that converts 'base 16' (hex) numbers