/ libft / src / ft_basics / ft_striteri.c
ft_striteri.c
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   ft_striteri.c                                      :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: ll-hotel <ll-hotel@student.42lyon.fr>      +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2023/11/07 20:43:28 by ll-hotel          #+#    #+#             */
 9  /*   Updated: 2024/02/23 03:43:47 by ll-hotel         ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  void	ft_striteri(char *s, void (*f)(unsigned int, char *))
14  {
15  	unsigned long long	i;
16  
17  	if (!s)
18  		return ;
19  	i = -1;
20  	while (s[++i])
21  		(*f)(i, s + i);
22  	s[i] = 0;
23  }