base struct
This commit is contained in:
31
lib/libft/srcs/str/ft_strchr.c
Normal file
31
lib/libft/srcs/str/ft_strchr.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/14 09:06:01 by nalebrun #+# #+# */
|
||||
/* Updated: 2024/11/25 16:15:57 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../libft.h"
|
||||
|
||||
char *ft_strchr(const char *s, int c)
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
|
||||
ch = c;
|
||||
i = 0;
|
||||
if (ch == '\0')
|
||||
return ((char *)&s[ft_strlen(s)]);
|
||||
while (s[i] != 0)
|
||||
{
|
||||
if (s[i] == ch)
|
||||
return ((char *)&s[i]);
|
||||
i++;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user