-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_striteri.c
executable file
·37 lines (33 loc) · 1.21 KB
/
ft_striteri.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mwilliam <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/13 17:38:36 by mwilliam #+# #+# */
/* Updated: 2016/12/06 18:09:38 by mwilliam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** Applies the function f to each character of s,
** passing its index as the first argument
*/
void ft_striteri(char *s, void (*f)(unsigned int, char *))
{
char *str;
int index;
index = 0;
str = s;
if (!str || !f)
return ;
if (str)
{
while (str[index])
{
f(index, str + index);
index++;
}
}
}