-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.c
40 lines (37 loc) · 1.2 KB
/
ft_printf.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
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atabiti <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/24 12:44:46 by atabiti #+# #+# */
/* Updated: 2021/12/07 14:47:19 by atabiti ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *s1, ...)
{
va_list holde;
int i;
int index;
i = 0;
index = 0;
va_start(holde, s1);
while (s1[i])
{
if (s1[i] == '%')
{
index = index + type(s1[i + 1], holde);
i++;
}
else
{
ft_putchar_fd(s1[i]);
index++;
}
i++;
}
va_end(holde);
return (index);
}