-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_pointer.c
More file actions
35 lines (31 loc) · 776 Bytes
/
Copy path_pointer.c
File metadata and controls
35 lines (31 loc) · 776 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
#include "main.h"
/**
* driver - selector for type of fun.
* @format: string.
* Description: the function loops through the structs
* selector[] ment of the struct.
* Return: a pointer
* structype selector - Struct
*/
int (*_pointer(char *format))(char *format, va_list)
{
int i;
structype selector[] = {
{"%c", printc},
{"%s", printstr},
{"%d", printint},
{"%i", printint},
{"%%", printpercent},
{"%x", printhex},
{"%X", printHEX},
{"%o", printocta},
{NULL, NULL}};
if (format[1] == ' ' || format[1] == '\0')
return (NULL);
for (i = 0; selector[i].q; i++)
{
if (format[1] == selector[i].q[1])
return (selector[i].u);
}
return (NULL);
}