title: what is wrong with this realloc use
body: <p>I'm trying to get unlimited input from user, using realloc. this is what i've done so far:</p>
  
  <pre><code>int getCharactersFromUser(char* arr,char terminator)
  {
  char c = getch();
  int length =0;
  while(c!=terminator)
      {
      arr = realloc(arr, sizeof (arr)*(++length));
      arr[length-1]=c;
      c = getch();
      }
  return length;
  }
  </code></pre>
  
  <p>i call this method with an arr like this: <code>char *unknownArr = calloc(0,sizeof *unknownArr);
  int length = getCharactersFromUser(&amp;unknownArr,TEMINATOR_FOR_LIST);</code>
  here <code>TEMINATOR_FOR_LIST</code> is <code>eof</code></p>