ft_printf/srcs/pf_strchr.c
2019-02-11 14:06:37 +01:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pf_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/11 07:42:57 by tmaze #+# #+# */
/* Updated: 2019/02/11 07:43:10 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
char *pf_strchr(const char *s, int c)
{
int i;
char *tmp;
if (s != NULL)
{
i = -1;
tmp = (char*)s;
while (++i == 0 || tmp[i - 1])
if (tmp[i] == c)
return (&tmp[i]);
}
return (NULL);
}