-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putptr.c
29 lines (26 loc) · 1.13 KB
/
ft_putptr.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putptr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ssottori <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/04 16:06:02 by ssottori #+# #+# */
/* Updated: 2023/12/07 21:58:41 by ssottori ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putptr(void *ptr)
{
uintptr_t cast;
char *base;
cast = (uintptr_t)ptr;
base = "0123456789abcdef";
if (ptr == NULL)
{
write(1, "(nil)", 5);
return (5);
}
write(1, "0x", 2);
return (ft_unbase(cast, 16, base) + 2);
}