title: Allocating memory to an array Automatically
body: <p>I'm thinking of a program which allocates memory side by side to an array while scanning it. I end up with this program and it is not working! (Surely I'm doing a BIG blunder ;) ) Need Help! Thanks in Advance! </p>
  
  <pre><code>char *arr;
  int c=1,i=0;
  arr=(char*)calloc(c,sizeof(char));
  do
  {
      arr[i]=getch();
      printf("%c",arr[i]);
      c=c+sizeof(char);
      arr=(char*)realloc(arr,c);
      i++;
  }while(arr[i-1]!=13);
  arr=(char*)realloc(arr,c);
  arr[i]='/0';
  printf("%d",sizeof(arr));
  puts(arr);
  free(arr);
  </code></pre>