Mine
public text v1 · immutable#include <stdlib.h>
#include <stdio.h>
int my_getnbr(char *str);
int my_put_nbr(char *str);
int my_putstr(char *str);
int my_putchar(char c);
/*int from2dec(int *nb, char *from)
{
}*/
char *dec2to(int nb, int to)
{
int i;
static char *rest;
i = 0;
rest = malloc(sizeof(nb) * sizeof(to));
while (nb / to)
{
rest[i] = (nb % to);
nb /= to;
i++;
}
rest[i] = '\0';
return (*rest);
}
int main()
{
my_putstr(dec2to(20, 2));
return (0);
}