printf/libft/src/ft_intrchr.c

29 lines
1.1 KiB
C
Raw Normal View History

2023-10-26 18:32:55 +02:00
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_intrchr.c :+: :+: */
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/11 16:14:50 by djonker #+# #+# */
/* Updated: 2023/10/18 16:59:15 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_intrchr(const char *s, int c)
{
int i;
if (!s)
return (-1);
i = 0;
while (s[i] != '\0')
i++;
i--;
while (i >= 0 && s[i] != c)
i--;
return (i);
}