-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathft_printf.c
More file actions
35 lines (32 loc) · 1.33 KB
/
ft_printf.c
File metadata and controls
35 lines (32 loc) · 1.33 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hiroshiusui <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/31 02:37:43 by hiroshius #+# #+# */
/* Updated: 2018/01/31 02:39:38 by hiroshius ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(char *format, ...)
{
va_list arguments;
int number_of_printed_characters;
number_of_printed_characters = 0;
va_start(arguments, format);
while (*format)
{
if (*format == '%')
handle_percent(&format, arguments, &number_of_printed_characters);
else if (*format != '%')
{
ft_putchar(*format);
number_of_printed_characters++;
format++;
}
}
va_end(arguments);
return (number_of_printed_characters);
}