Microsoft Interview Question

Write an atoi function in C given a string and a base to which you want to convert. For example String s = "11", int Base = 2. Then the output will be equal to 3.