title: The table crashes after printing more than 15 lines from the matrix
body: <p>I have to separate every word from a string and each word has to be put in a row in a matrix. A word is separated by spaces, tabs, newlines then the program prints each line. The end of the matrix is marked by 0.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  char    *ft_strdups(char *str, int start, int to)
  {
      char *p;
      int i;
  
      i = 0;
      if (to &lt; start)
          return (NULL);
  
      p = (char*) malloc(sizeof(char)*(to - start + 1));
      if (!p)
          return (NULL);
  
      while(start &lt; to &amp;&amp; str[start])
      {
          p[i] = str[start];
          start++;
          i++;
      }
      p[i] = '\0';
      return (p); // This function dynamicaly allocates the string
  }
  
  int     tw(char *str)
  {
      int i;
      i = 0;
      while (str[i] != '\t' &amp;&amp; str[i] != '\n' &amp;&amp; str[i] != ' ' &amp;&amp; str[i])
          i++;
      return (i); // This function traverses the word and returns the length
  }
  
  int     nb_words(char *str) // counts the numbers of words
  {
      int i;
      int k;
      k = 0;
      while (str[i] != '\0')
      {
          if(str[i] != '\t' &amp;&amp; str[i] != '\n' &amp;&amp; str[i] != ' ' &amp;&amp; str[i])
          {
              i = i + tw(str + i);
              k++;
          }
          else
              i++;
      }
      return (k);
  }
  
  char    **ft_split_whitespaces(char *str)
  {
      int     i;
      char    **p;
      int     j;
      j = 0;
      i = 0;
      p = (char**)malloc(sizeof(char) * (nb_words(str) + 1));
      while(str[i] != '\0')
      {
          if (str[i] != '\n' &amp;&amp; str[i] != '\t' &amp;&amp; str[i] != ' ')
          {
              p[j] = ft_strdups(str, i, i + tw(str + i));;
              j++; // here is the allocation
              i = tw(str + i) + i;
          }
          else
              i++;
      }
      p[j] = 0;
      return (p);
  }
  
  int     main(int ac, char **av)
  {
      char **p;
      int i;
      i = 0;
      if(ac != 2)
          return(0);
      p = ft_split_whitespaces(av[1]);
      while (p[i])
      {   
          printf("%s\n",p[i]);
          i++;
      }
  }
  </code></pre>
  
  <p>The problem is that if i give a string that has more than 16 words (ex: <code>./a.out "1 2     3   4 5  6 7    8   9  10 11 12  13     14       15   16     17   18   19    20"</code>) it crashes causing the printing of some non ascii characters instead of my previous words.</p>