-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_int_to_hex.c
More file actions
33 lines (29 loc) · 1.28 KB
/
Copy pathft_int_to_hex.c
File metadata and controls
33 lines (29 loc) · 1.28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_int_to_hex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mraineri <mraineri@student.42lisboa.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/10 19:22:03 by mraineri #+# #+# */
/* Updated: 2024/09/03 12:36:49 by mraineri ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_int_to_hex(unsigned int decimal, int *counter)
{
char *hex;
hex = "0123456789ABCDEF";
if (decimal >= 16)
ft_int_to_hex(decimal / 16, counter);
write(1, &hex[decimal % 16], 1);
if (counter)
(*counter)++;
}
// int main(void)
// {
// int count = 0;
// ft_int_to_hex(605, &count);
// printf("\n\nNumber of characters printed: %d\n\n", count);
// return 0;
// }