title: Dynamical array of strings in C
body: <p>I'm trying to make array of strings, I have function <code>rLine</code> which reads line from stdin, each inputted line I need to save in array, but I don't have any idea about number of inputted string lines. So I need to dynamically increase array size to store them, I wrote such code:</p>
  
  <pre><code>char *res[2], *old = res;
  while( 1 ){
    line = rLine( stdin ), len = strlen( line );
    res[row] = (char*)malloc( len + 1);
    strcpy( res[row++], line);
    res = (char**) realloc( res, row ); /* adding 1 more row, not sure adding size row? */
    if ( /*some cond*/ ) break;
  }
  </code></pre>
  
  <p>But this code doesn't seem to work, how correctly declare array and increase it size?</p>