-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr_pf.c
33 lines (31 loc) · 1.23 KB
/
ft_putnbr_pf.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_pf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adiaz-be <adiaz-be@student.42malaga.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/14 18:29:22 by adiaz-be #+# #+# */
/* Updated: 2022/10/14 18:29:48 by adiaz-be ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_putnbr_pf(int num, size_t *counter)
{
if (num == -2147483648)
{
ft_putnbr_pf((num / 10), counter);
ft_putchar_pf('8', counter);
}
else if (num < 0)
{
ft_putchar_pf('-', counter);
ft_putnbr_pf(-num, counter);
}
else
{
if (num > 9)
ft_putnbr_pf((num / 10), counter);
ft_putchar_pf(('0' + num % 10), counter);
}
}