Skip to content

Instantly share code, notes, and snippets.

@qleguennec
Created December 7, 2015 17:18
Show Gist options
  • Select an option

  • Save qleguennec/f7538797b5f16c9bf3b8 to your computer and use it in GitHub Desktop.

Select an option

Save qleguennec/f7538797b5f16c9bf3b8 to your computer and use it in GitHub Desktop.
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qle-guen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/24 09:49:17 by qle-guen #+# #+# */
/* Updated: 2015/11/24 10:12:32 by qle-guen ### ########.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
static void ft_striteri_helper(char *s, unsigned int i, void (*f)(unsigned int, char*))
{
if (*s)
{
f(i, s);
ft_striteri_helper(s + 1, i + 1, f);
}
}
void ft_striteri(char *s, void (*f)(unsigned int, char*))
{
ft_striteri_helper(s, 0, f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment