-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_striteri.c
executable file
·36 lines (31 loc) · 1.33 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchoy-me <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/11 14:30:41 by jchoy-me #+# #+# */
/* Updated: 2023/07/17 16:32:27 by jchoy-me ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
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.
PARAMETERS:
s: The string on which to iterate.
f: The function to apply to each character.
*/
void ft_striteri(char *s, void (*f)(unsigned int, char*))
{
unsigned int i;
i = 0;
while (s[i] != '\0')
{
f(i, &(s[i]));
i++;
}
}