32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strchr.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2023/10/30 16:16:43 by madumerg #+# #+# */
|
||
|
/* Updated: 2023/11/07 17:50:18 by madumerg ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
char *ft_strchr(const char *str, int p)
|
||
|
{
|
||
|
int i;
|
||
|
|
||
|
i = 0;
|
||
|
if (!str)
|
||
|
return (NULL);
|
||
|
while (str[i] != '\0')
|
||
|
{
|
||
|
if (str[i] == (unsigned char)p)
|
||
|
return ((char *) &str[i]);
|
||
|
i++;
|
||
|
}
|
||
|
if (str[i] == (unsigned char)p)
|
||
|
return ((char *) &str[i]);
|
||
|
return (0);
|
||
|
}
|