title: Confused about "while(getchar() != '\n')"
body: <p>I knew that <code>getchar(</code>) is just a function gets the first character of the line the user entered then the next and so on
  And if we typed <code>getchar()</code> in a line, at the finishing of the code,it's for let the program wait for user to type any thing and for not closing the console when displaying the info.</p>
  
  <p>why we use this line of code ?</p>
  
  <p><em><strong>while(getchar()!='\n');</em></strong></p>
  
  <p>I knew that it reads all characters of the line until the end of line is found then the loop breaks .. right .? But, why this is useful ? What if we don't write this line of code ?</p>
  
  <pre><code>while((ch=fgetc(stream))!=EOF)
  {
      putchar(ch);
      cha++;
      if(ch=='\n')
      {
          lines++;
          printf("Line %i is detected\n\n",lines);
          if(lines==NEW_LINE)
          {
          lines=0;
          while (getchar!='\n'); **//Here is my question**
          }
      }
  }
  </code></pre>