-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_striter_bonus.c
34 lines (30 loc) · 1.22 KB
/
ft_striter_bonus.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: aviholai <aviholai@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/24 16:21:10 by aviholai #+# #+# */
/* Updated: 2022/02/09 16:39:03 by aviholai ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** 'Striter()' (String iterate) applies the parameter function 'f' to each
** character of the string argument '*s'. Each character is passed by address
** to 'f' to be modified if necessary.
*/
void ft_striter(char *s, void (*f)(char *s))
{
unsigned int i;
if (s)
{
i = 0;
while (s[i] != '\0')
{
f(s + i);
i++;
}
}
}