ft_nb_word.c 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_nb_word.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2017/02/17 18:19:42 by bchanot #+# #+# */
  9. /* Updated: 2018/10/14 03:27:56 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. size_t ft_nb_word(const char *src)
  14. {
  15. size_t i;
  16. i = 0;
  17. while (*src)
  18. {
  19. while (*src && *src < 33)
  20. src++;
  21. if (*src)
  22. i++;
  23. while (*src && *src > 32)
  24. src++;
  25. }
  26. return (i);
  27. }