-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_putptr_printf.c
More file actions
31 lines (28 loc) · 1.23 KB
/
ft_putptr_printf.c
File metadata and controls
31 lines (28 loc) · 1.23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putptr_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pmolzer <pmolzer@student.42berlin.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/01 16:03:20 by pmolzer #+# #+# */
/* Updated: 2024/01/01 16:03:20 by pmolzer ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_putptr_printf(void *ptr, size_t *counter)
{
char *str;
unsigned long ptr_address;
if (!ptr)
{
ft_putstr_printf("(nil)", counter);
return ;
}
ptr_address = (unsigned long)ptr;
ft_putstr_printf("0x", counter);
str = ft_aux_printf(ptr_address, HEX_LOW_BASE);
ft_putstr_printf(str, counter);
free(str);
str = NULL;
}