-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_striteri.c
35 lines (31 loc) · 1.29 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aviholai <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/24 16:24:54 by aviholai #+# #+# */
/* Updated: 2022/02/09 16:39:46 by aviholai ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** 'Striteri()' (String iterate integer) applies the parameter function
** 'f' to each character of the string argument '*s', and passing its index
** as first argument. Each character is passed by address
** to 'f' to be modified if necessary.
*/
void ft_striteri(char *s, void (*f)(unsigned int, char *))
{
unsigned int i;
if (s)
{
i = 0;
while (s[i] != '\0')
{
f(i, s + i);
i++;
}
}
}