-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_conditions.c
More file actions
33 lines (31 loc) · 1.44 KB
/
ft_conditions.c
File metadata and controls
33 lines (31 loc) · 1.44 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
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_conditions.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ychihab <ychihab@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/02 16:58:01 by ychihab #+# #+# */
/* Updated: 2022/11/06 17:32:52 by ychihab ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_conditions(va_list list, char *s, int i, int *j)
{
if (s[i] == 'c')
ft_putchar(va_arg(list, int), j);
else if (s[i] == 'd')
ft_putnbr(va_arg(list, int), j);
else if (s[i] == 'i')
ft_putnbr(va_arg(list, int), j);
else if (s[i] == 's')
ft_putstr(va_arg(list, char *), j);
else if (s[i] == 'x')
ft_x(va_arg(list, unsigned int), j);
else if (s[i] == 'X')
ft_upper_x(va_arg(list, unsigned int), j);
else if (s[i] == 'p')
ft_address(va_arg(list, unsigned long), j);
else if (s[i] == 'u')
ft_putnbr_u(va_arg(list, unsigned int), j);
}