title: different behaviour of program
body: <p>Here is a small program in C.
  I want to get user input in a while loop and I also want to take white space in line so I used <code>scanf("%[^\n]s",name);</code> but it gives a different output. It's stuck in the while loop.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (int argc, char const *argv[])
  {
      do
      {
      char name[20];
      scanf("%[^\n]s",name);
      printf("%s\n", name);
      }while (1);
      return 0;
  }
  </code></pre>
  
  <p>output :</p>
  
  <pre><code>adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  adAD A SAF A SA FA
  </code></pre>
  
  <p>I want to take input from user with white spaces inside using a while loop.</p>