-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.c
35 lines (32 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
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dnakano <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/09 07:26:44 by dnakano #+# #+# */
/* Updated: 2020/10/18 14:24:58 by dnakano ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdarg.h>
#include "libftprintf.h"
int ft_printf(const char *format, ...)
{
int count;
va_list ap;
va_start(ap, format);
count = 0;
while (*format)
{
if (*format == '%')
format = ft_printf_putarg(format + 1, &ap, &count);
else
{
ft_putchar_fd(*(format++), 1);
count++;
}
}
va_end(ap);
return (count);
}