-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
37 lines (34 loc) · 1.2 KB
/
ft_printf.c
File metadata and controls
37 lines (34 loc) · 1.2 KB
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: ktolba <tolbakevin@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/01 11:49:43 by ktolba #+# #+# */
/* Updated: 2025/06/06 16:02:29 by ktolba ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *str, ...)
{
va_list args;
size_t i;
size_t len;
i = 0;
len = 0;
va_start(args, str);
while (str[i])
{
if (str[i] == '%' && str[i + 1])
{
len += ft_dispatch_args(args, &str[i + 1]);
i++;
}
else
len += ft_putchar_pf(str[i]);
i++;
}
va_end(args);
return (len);
}