-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf_x.c
38 lines (33 loc) · 1.2 KB
/
ft_printf_x.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
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_x.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: omoudni <omoudni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/09 23:56:49 by omoudni #+# #+# */
/* Updated: 2021/12/10 21:27:42 by omoudni ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_puthex_x(unsigned int p, int *i)
{
char *base;
base = "0123456789abcdef";
if (p < 16)
{
write (1, &base[p], 1);
(*i)++;
}
else
{
ft_puthex_x(p / 16, i);
ft_puthex_x(p % 16, i);
}
}
void ft_printf_x(va_list args, int *i)
{
int p;
p = va_arg(args, unsigned long);
ft_puthex_x(p, i);
}