title: memory allocation for char pointer
body: <p>I am actually supposed to dynamically store a <code>string</code>. I have tried the below, 
  It is printing everything but it terminating as soon as a space is included in my input. can someone explain is why?</p>
  
  <p>Also what is the right way to do it :</p>
  
  <pre><code>int i;
  char *a;
  a=(char *)malloc(sizeof(char));
  scanf("%s",a);
  for(i=0;*(arr+i)!='\0';i++)
     printf("%c",*(arr+i));
  </code></pre>