-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printf.c
37 lines (34 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: azaher <azaher@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/30 12:06:36 by azaher #+# #+# */
/* Updated: 2022/11/21 21:13:41 by azaher ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *s, ...)
{
va_list ap;
int i;
size_t count;
i = 0;
count = 0;
va_start(ap, s);
while (s[i])
{
if (s[i] == '%')
{
if (s[i + 1])
count += print_params(ap, s[i + 1], &i);
else
return (count);
}
else
count = count + ft_putchar(s[i++]);
}
return (count);
}