copy on git
This commit is contained in:
commit
42653de246
205 changed files with 7459 additions and 0 deletions
30
libft/ft_striteri.c
Executable file
30
libft/ft_striteri.c
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_striteri.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 16:56:31 by thrieg #+# #+# */
|
||||
/* Updated: 2025/02/16 19:04:45 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
//returns without doing anything if s or f are NULL, this is dumb because we
|
||||
//can't report the error given the prototyping but I'm not taking any risk for
|
||||
//my 3th retry...
|
||||
void ft_striteri(char *s, void (*f)(unsigned int, char*))
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!s || !f)
|
||||
return ;
|
||||
i = 0;
|
||||
while (s[i])
|
||||
{
|
||||
f(i, &s[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue