libft
ft_strchr.c
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* ft_strchr.c :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2019/09/04 23:24:43 by unite #+# #+# */
10 /* Updated: 2020/07/16 02:51:17 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #include "libft.h"
15 
20 char *ft_strchr(const char *s, int c)
21 {
22  size_t i;
23 
24  i = 0;
25  while (s[i])
26  {
27  if (s[i] == c)
28  return ((char *)(s + i));
29  i++;
30  }
31  if (c == 0)
32  return ((char *)(s + i));
33  else
34  return (NULL);
35 }
ft_strchr
char * ft_strchr(const char *s, int c)
Replicates behaviour of strchr from libc.
Definition: ft_strchr.c:20
libft.h