aboutsummaryrefslogtreecommitdiff
path: root/src/ft_striteri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_striteri.c')
-rw-r--r--src/ft_striteri.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ft_striteri.c b/src/ft_striteri.c
new file mode 100644
index 0000000..05f15d4
--- /dev/null
+++ b/src/ft_striteri.c
@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_striteri.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 10:33:09 by cacharle #+# #+# */
+/* Updated: 2019/11/20 02:01:41 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void ft_striteri(char *s, void (*f)(unsigned int, char *))
+{
+ unsigned int i;
+
+ if (s == NULL || f == NULL)
+ return ;
+ i = 0;
+ while (s[i])
+ {
+ (*f)(i, &s[i]);
+ i++;
+ }
+}