Question: Programming language to use is C In convert.c, there is a function called btoi which takes two arguments, a character array (for a string) and

Programming language to use is C

In convert.c, there is a function called btoi which takes two arguments, a character array (for a string) and a numeric argument.

The first argument is the string representation of a number in a base.

The second argument is the numeric base.

The return value for this function is going to by the numeric value for the string representation of the number. It's very like atoi in the class notes.

If the number is invalid, like with atoi, we're going to return 0. Ignore leading spaces.

The function should return once you reach the first invalid character in the string, just like atoi.

This function should be able to make use of the digit_btoi function on each character in the string to save you some headaches. That way, you don't need to fumble with ASCII code manipulation in this part of the code.

btoi("ZOOT", 36) = 1664957

btoi("HELLO", 36) = 29234652

btoi("2018", 10) = 2018

btoi("7F", 16) = 127

btoi("9", 8) = 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!