-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_pointer.c
More file actions
36 lines (31 loc) · 1.24 KB
/
ft_pointer.c
File metadata and controls
36 lines (31 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_pointer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bahbibe <bahbibe@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/04 04:48:44 by bahbibe #+# #+# */
/* Updated: 2022/11/04 08:04:25 by bahbibe ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
static void ft_phex(unsigned long nb, int *ret)
{
char *hex_base;
hex_base = "0123456789abcdef";
if (nb < 16)
ft_putchar(hex_base[nb % 16], ret);
else
{
ft_phex(nb / 16, ret);
ft_phex(nb % 16, ret);
}
}
void ft_pointer(const void *p, int *ret)
{
unsigned long ptr;
ptr = (unsigned long )p;
ft_putstr("0x", ret);
ft_phex(ptr, ret);
}