-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_puthexa_low.c
More file actions
46 lines (44 loc) · 1.29 KB
/
Copy pathft_puthexa_low.c
File metadata and controls
46 lines (44 loc) · 1.29 KB
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
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_puthexa_low.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yelallam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/28 10:18:10 by yelallam #+# #+# */
/* Updated: 2025/11/30 17:45:41 by yelallam ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_puthexa_low(uintptr_t n)
{
int arr[16];
char *str;
int i, (count);
str = "0123456789abcdef";
i = 0;
count = 0;
if (n == 0)
{
ft_putchar_fd('0', 1);
return (1);
}
while (n > 0)
{
arr[i] = n % 16;
n = n / 16;
i++;
}
while (i > 0)
{
i--;
ft_putchar_fd(str[arr[i]], 1);
count++;
}
return (count);
}
/*int main()
{
int i = ft_puthexa_low(84343096);
printf("\n%d", i);
}*/