-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_ptr.c
More file actions
26 lines (23 loc) · 1.16 KB
/
Copy pathft_printf_ptr.c
File metadata and controls
26 lines (23 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_ptr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dliuzzo <dliuzzo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/23 11:25:31 by dliuzzo #+# #+# */
/* Updated: 2023/11/23 11:50:56 by dliuzzo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf_ptr(va_list args, char flag)
{
uintptr_t ptr;
ptr = va_arg(args, uintptr_t);
if (ptr == 0)
return ((int)write(1, "(nil)", 5));
else
write(1, "0x", 2);
ft_putnbr_hexa(ptr, flag);
return (ft_digit_count_hexa((unsigned long long)ptr, 16) + 2);
}