-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putx_printf.c
31 lines (27 loc) · 1.17 KB
/
ft_putx_printf.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putx_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jbergos <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/24 02:10:27 by jbergos #+# #+# */
/* Updated: 2024/10/24 22:28:10 by jbergos ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static int ft_putxhexa(unsigned int nb, int n)
{
if (nb >= 16)
n = (ft_putxhexa(nb / 16, n));
n += ft_putchar_printf(HEXA[nb % 16]);
return (n);
}
int ft_putx_printf(int n)
{
int count;
unsigned int nb;
count = 0;
nb = (unsigned int)n;
return (ft_putxhexa(nb, count));
}