-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_striter.c
34 lines (30 loc) · 1.23 KB
/
ft_striter.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vinguyen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/10 12:19:21 by vinguyen #+# #+# */
/* Updated: 2019/10/10 12:19:23 by vinguyen ### ########.fr */
/* */
/* ************************************************************************** */
/*
** Applies the function f to each char of the str passed as arg
** Each char is passed by add to f to be modified if necessary
** Param: (string to iterate, function to apply to each char of s)
** Return: None
*/
#include "libft.h"
void ft_striter(char *s, void (*f)(char *))
{
size_t i;
i = 0;
if (!s || !f)
return ;
while (s[i])
{
f(&s[i]);
i++;
}
}