31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strchr.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: pbonilla <eirodeis.lepnj@gmail.com> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2020/10/29 12:37:26 by pbonilla #+# #+# */
|
||
|
/* Updated: 2020/12/04 15:40:05 by pbonilla ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
char *ft_strchr(const char *s, int c)
|
||
|
{
|
||
|
int i;
|
||
|
char *buff;
|
||
|
|
||
|
buff = (char *)s;
|
||
|
i = -1;
|
||
|
while (buff[++i])
|
||
|
{
|
||
|
if (buff[i] == (char)c)
|
||
|
return ((char *)&buff[i]);
|
||
|
}
|
||
|
if (buff[i] == (char)c)
|
||
|
return ((char *)&buff[i]);
|
||
|
return (NULL);
|
||
|
}
|