Question
write a program in C plain, there is a function called itob which takes three arguments, a character array (for a buffer) and two numeric
write a program in C plain, there is a function called itob which takes three arguments, a character array (for a buffer) and two numeric arguments.
The first argument is a buffer which has been passed to the function so that it can return a string value, like with fscanf and fgets.
The second argument is the numeric base for which you should be producing the representation.
The third argument, is the actual number that you're producing the representation of.
This function is void, since it is returning the string value through the first argument.
If the number is negative, the function should return the string "0\0".
Follow the process we described in the discussion on Modulo to extract digits from a number.
This function should be able to make use of the digit_itob function on each digit, again to avoid the headache of doing ASCII manipulation in this function.
itob(buffer, 36, 1664957) buffer = "ZOOT"
itob(buffer, 36, 29234652) buffer = "HELLO"
itob(buffer, 10, 2018) buffer = "2018"
itob(buffer, 16, 127) buffer = "7F"
itob(buffer, 10, -1) buffer = "0"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started