-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr_unsigned.c
36 lines (33 loc) · 1.21 KB
/
ft_putnbr_unsigned.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
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_unsigned.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: made-ara <made-ara@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/07 11:50:07 by made-ara #+# #+# */
/* Updated: 2024/08/07 15:56:40 by made-ara ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_putnbr_unsigned(int n)
{
char *str;
int len;
long int n_negative;
len = 0;
if (n < 0)
{
n_negative = 4294967296 + n;
str = ft_itoa(n_negative);
len = write(1, str, ft_strlen(str));
free(str);
}
else
{
str = ft_itoa(n);
len = write(1, str, ft_strlen(str));
free(str);
}
return (len);
}