Skip to content

Commit

Permalink
write numbers in hexadecimal lower %x (base 16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Walid Araissi committed Nov 10, 2022
1 parent 3db125b commit 108e39c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ft_putnbr_base_lower.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@
/* By: waraissi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/09 18:42:57 by waraissi #+# #+# */
/* Updated: 2022/11/09 20:15:19 by waraissi ### ########.fr */
/* Updated: 2022/11/10 17:45:04 by waraissi ### ########.fr */
/* */
/* ************************************************************************** */

#include "ft_printf.h"

void ft_putnbr_base_lower(unsigned int nbr, int *res)
void ft_putnbr_base_lower(unsigned int nbr, int *res)
{
char base[] = "0123456789abcdef";
char *base;

base = "0123456789abcdef";
if (nbr < 16)
ft_putchar(base[nbr], res);
ft_putchar(base[nbr], res);
else
{
ft_putnbr_base_lower(nbr / 16, res);
ft_putnbr_base_lower(nbr % 16, res);
}
}
}

0 comments on commit 108e39c

Please sign in to comment.