title: dynamically allocating a string with unknown size
body: <p>I have to get <code>names</code> with a known number of names from input as one string each separated by a space, I have to dynamically allocate memory for an array of strings where each string gets a name, </p>
  
  <pre><code>    char** names;
      char ch;
      names = malloc(N*sizeof(char*); /*N is defined*/
  
      for(i=0; i&lt;N; i++) {
  </code></pre>
  
  <p>Now I have to allocate for each string without using a defined number:</p>
  
  <pre><code>    i=0, j=0;
      while ((ch=getchar) != '\n') {
           while (ch != ' ') {
                names[i][j++] = ch;
           }
           if (ch == ' ') {
                names[i][j] = '\0';
                i++}}
      if (ch == '\n')
           names[i][j] = '\0';
  </code></pre>