libft/str/ft_striteri.c
Raphael 905ffd4b72
refactor: only the usefull header
- Removing all 'libft.h' mention
- Using the include only on the files needed by
2025-09-01 18:45:33 +02:00

33 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_striteri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/09 13:57:34 by rparodi #+# #+# */
/* Updated: 2025/09/01 17:50:26 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
/**
* @brief Applies a function to each character of a string.
*
* @param s The string to modify.
* @param f The function to apply to each character.
*
* @return void
*/
void ft_striteri(char *s, void (*f)(unsigned int, char*))
{
size_t i;
i = 0;
while (s[i] != '\0')
{
f(i, s + i);
i++;
}
}