diff options
Diffstat (limited to 'libft/ft_striteri.c')
-rw-r--r-- | libft/ft_striteri.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libft/ft_striteri.c b/libft/ft_striteri.c new file mode 100644 index 0000000..d7ed90b --- /dev/null +++ b/libft/ft_striteri.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_striteri.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/09/29 02:06:44 by kdx #+# #+# */ +/* Updated: 2022/10/14 02:25:22 by kdx ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_striteri(char *s, void (*f)(unsigned int, char*)) +{ + size_t i; + + if (s == NULL || f == NULL) + return ; + i = 0; + while (s[i] != '\0') + { + f(i, s + i); + i += 1; + } +} |