-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.c
38 lines (35 loc) · 1.19 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ael-haib <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/25 03:13:44 by ael-haib #+# #+# */
/* Updated: 2024/03/29 11:20:59 by ael-haib ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *str, ...)
{
int j;
int i;
va_list ptr;
j = 0;
i = 0;
va_start(ptr, str);
while (str[i])
{
if (str[i] == '%')
{
if (!str[i + 1])
return (j);
j += ft_checker(str[++i], ptr);
}
else
j += ft_putchar(str[i]);
i++;
}
va_end(ptr);
return (j);
}