Archived
1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
libft/ft_strchr.c

35 lines
1.1 KiB
C
Raw Normal View History

2023-11-03 16:21:15 +01:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
/* Updated: 2023/11/02 10:08:05 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strchr(const char *s, int c)
{
int i;
int j;
char *str_result;
i = 0;
j = 0;
while (s[i] != c || s[i])
i++;
if (s[i] == c)
{
while (s[i])
{
str_result[j] = s[j + i];
j++;
}
return (str_result);
}
str_result[0] = '\0';
return (str_result);
}