-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_print_hex_low.c
30 lines (27 loc) · 1.15 KB
/
ft_print_hex_low.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_hex_low.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aelkheta <aelkheta@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/27 15:16:32 by aelkheta #+# #+# */
/* Updated: 2023/11/27 15:19:38 by aelkheta ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_print_hex_low(unsigned int x)
{
int counter;
char *s;
s = "0123456789abcdef";
counter = 0;
if (x < 16)
counter += ft_print_char(s[x]);
else
{
counter += ft_print_hex_low(x / 16);
counter += ft_print_char(s[x % 16]);
}
return (counter);
}