-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_striteri.c
28 lines (25 loc) · 1.13 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ibeliaie <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/18 15:04:45 by ibeliaie #+# #+# */
/* Updated: 2023/05/23 14:37:54 by ibeliaie ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* apply function ’f’ on each character of string, along with it's index */
void ft_striteri(char *str, void (*f)(unsigned int, char*))
{
int i;
if (!str || !f)
return ;
i = 0;
while (str[i] != '\0')
{
f(i, str + i);
i++;
}
}