K&R C Exercise 2-3: htoi — Convert Hex String to Integer

Exercise 2-3. Write the function htoi(s), which converts a string of hexadecimal digits (including an optional 0x or 0X) into its equivalent integer value. The allowable digits are 0 through 9, a through f, and A through F. How htoi Works Hexadecimal is simply base-16 positional notation. Converting from a hex string to an integer …