Work on the function to convert an integer to any base and return the result as string
Closed this issue · 0 comments
nanafox commented
Here's the prototype to use
#include "main.h"
/**
* _itob - convert integer to the specified base and stores the result
* as a string
*
* @number: the number to convert
* @buffer: the string buffer to store the result
* @base: the base to convert @number to
*/
void _itob(ssize_t number, char *buffer, int base);
Your function should handle bases 2, 8, 10, and 16. The main.h
has macros for these tokens, use them.
Example: BIN
is assigned to 2, HEX
to 16