If you know that all characters fooare numbers, you can use (int) (foo[i] - '0')that subtracts the ascii value '0'from the character. This works for all digits because their ascii values are sequential.
Your first attempt failed because it foo[i]is one charand atoi()cstring. The second attempt fails because it &foo[i]is a reference to this character.