-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_printf.c
More file actions
40 lines (34 loc) · 749 Bytes
/
_printf.c
File metadata and controls
40 lines (34 loc) · 749 Bytes
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
39
#include "main.h"
/**
* _printf - print format of a character
* @format: string containing all desired characters
*
* Return: number of characters printed
*/
int _printf(const char *format, ...)
{
int printed_chars;
conver_t f_list[] = {
{"c", print_char},
{"s", print_string},
{"%", print_percent},
{"d", print_integer},
{"i", print_integer},
{"b", print_binary},
{"u", unsigned_integer},
{"r", print_reversed},
{"R", rot13},
{"o", print_octal},
{"x", print_hex},
{"X", print_heX},
{NULL, NULL}
};
va_list arg_list;
if (format == NULL)
return (-1);
va_start(arg_list, format);
/*Calling parser function*/
printed_chars = parser(format, f_list, arg_list);
va_end(arg_list);
return (printed_chars);
}