ft_strchr.c 1.1 KB

12345678910111213141516171819202122232425
  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: 2016/03/16 16:58:20 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. char *ft_strchr(const char *s, int c)
  14. {
  15. char *str;
  16. str = (char*)s;
  17. while (*str != (char)c && *str != '\0')
  18. str++;
  19. if (*str == (char)c)
  20. return (str);
  21. return (NULL);
  22. }