-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.c
34 lines (31 loc) · 1.21 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hhamza <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/22 09:33:10 by hhamza #+# #+# */
/* Updated: 2021/12/23 19:47:16 by hhamza ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *format, ...)
{
va_list ap;
int written;
int i;
va_start(ap, format);
written = 0;
i = 0;
while (format[i] != '\0')
{
if (format[i] == '%')
written += ft_parse_conversion(format[++i], &ap);
else
written += ft_putchar(format[i]);
++i;
}
va_end(ap);
return (written);
}