C reading input in while loop
<p>In c what does this do after gets </p>

<pre><code>int c; 
while ((c = getchar()) != EOF &amp;&amp; c != '\n');
</code></pre>

<p>I saw that many of you are telling me its while loop and all, why so much complication to it? Why cant we just use this code which I have given below?</p>

<pre><code>gets(name);
if(name == '\n'|| name == EOF) 
    gets(name);`
</code></pre>