Pergunta de entrevista da empresa Microsoft

Design a function that converts a string to an integer.