-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_striteri.c
39 lines (35 loc) · 1.32 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
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: emdi-mar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/08 22:04:41 by emdi-mar #+# #+# */
/* Updated: 2024/11/08 22:45:13 by emdi-mar ### ########.fr */
/* */
/* ************************************************************************** */
/*
** LIBRARY: libft
**
** DESCRIPTION:
** Applies the function 'f' on each character of the string passed as
** argument, passing its index as first argument.
** Each character is passed by address to 'f' to be modified if necessary.
*/
#include "libft.h"
void ft_striteri(char *s, void (*f)(unsigned int, char*))
{
size_t len;
unsigned int i;
i = 0;
if (s && f)
{
len = ft_strlen(s);
while ((size_t)i < len)
{
f(i, &(s[i]));
i++;
}
}
}