libft
Loading...
Searching...
No Matches
ft_strchr.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_strchr.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tspoof <tspoof@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2022/10/31 11:07:09 by tspoof #+# #+# */
9/* Updated: 2022/11/24 15:13:04 by tspoof ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15char *ft_strchr(const char *s, int c)
16{
17 int slen;
18 int i;
19
20 slen = ft_strlen((char *)s);
21 i = 0;
22 while (i < slen + 1)
23 {
24 if (s[i] == (unsigned char)c)
25 {
26 return ((char *)(s + i));
27 }
28 i++;
29 }
30 return (NULL);
31}
char * ft_strchr(const char *s, int c)
Search a character.
Definition ft_strchr.c:15
size_t ft_strlen(const char *s)
Length of the string.
Definition ft_strlen.c:15