-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_put_ptr.c
35 lines (32 loc) · 1.14 KB
/
ft_put_ptr.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
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_put_ptr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: oqaroot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/01 20:41:57 by oqaroot #+# #+# */
/* Updated: 2024/08/03 19:43:40 by oqaroot ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
#include <limits.h>
int ft_put_ptr(void *ptr)
{
int len;
unsigned long n;
len = 0;
n = (unsigned long)ptr;
write(1, "0x", 2);
len += 2;
if (ptr == NULL)
{
write(1, "0", 1);
len += 1;
}
else
{
ft_put_hex(n, 0);
}
return (len);
}