title: stopping scanf on pressing enter
body: <p>I am writing a C program which takes string input and print each word in a separate line. But the program is not stopping even after pressing enter. Please suggest a solution.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  int main(void)
  {
      char str[50];
      while(scanf("%s",str)&amp;&amp;strcmp(str,"\n"))
          printf("%s\n",str);
  
  }
  </code></pre>