Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 14th, 2018 90 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include "libft.h"
  2. #include <stdio.h>
  3.  
  4. int     ft_count_words(char const *s, char c, int bob, int trigger, int nb)
  5. {
  6.     if (!s[bob])
  7.         return (nb);
  8.     if (trigger == 0)
  9.     {
  10.         if (s[bob] == c)
  11.             return(ft_count_words(s, c, bob + 1, 0, nb));
  12.         else
  13.             return(ft_count_words(s, c, bob + 1, 1, nb + 1));
  14.     }
  15.     else
  16.     {
  17.         if (s[bob] == c)
  18.             return(ft_count_words(s, c, bob + 1, 0, nb));
  19.         else
  20.             return(ft_count_words(s, c, bob + 1, 1, nb));
  21.     }
  22. }
  23.  
  24. char    **ft_strsplit(char const *s, char c)
  25. {
  26.     int     bob;
  27.     int     vlad;
  28.     char    **tab;
  29.  
  30.     bob = 0;
  31.     vlad = ft_count_words(s, c, 0, 0, 0);
  32.     printf("%d", vlad);
  33.     return (tab);
  34. }
  35.  
  36. int     main(int ac, char **av)
  37. {
  38.     (void)ac;
  39.  
  40.     ft_strsplit(av[1], av[2][0]);
  41.     return (0);
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top