title: What is the use of fflush(stdin) in c programming?
body: <p>I have the following program</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
     char ans[8];
      int i;
      for(i=1;i&lt;=3;i++)
      {
          printf(&quot;\n What is the unit of traffic ?&quot;);
          scanf(&quot;%s&quot;,ans);
          fflush(stdin);
  
          if(stricmp(ans,&quot;Earlang&quot;)==0)
          {
              printf(&quot;\nAnswer is correct&quot;);
              exit(1);
          }
          else
              if(i&lt;3)
              printf(&quot;\n Try Again!\n&quot;);
      }
      printf(&quot;\n Nunit of traffic is Earlang:&quot;);
  }
  </code></pre>
  <p>What is the use of <code>fflush(stdin)</code> in this program?</p>