ft_strchr.c 1.1 KB

123456789101112131415161718192021222324
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strchr.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2015/11/25 13:32:36 by bchanot #+# #+# */
  9. /* Updated: 2018/10/11 22:27:45 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. char *ft_strchr(const char *s, int c)
  14. {
  15. if (!s)
  16. return (NULL);
  17. while (*s != (char)c && *s != '\0')
  18. s++;
  19. if (*s == (char)c)
  20. return ((char *)s);
  21. return (NULL);
  22. }