Difference between return values of scanf("%s", str) and scanf("%[^\n]s", str)
<pre><code>while(scanf(&quot;%s&quot;,a))
{
     if(a[0]=='#')
         break;
     nextpermutation(a);
}
</code></pre>
<p>This while loop perfectly works for <code>scanf(&quot;%s&quot;, a)</code>
but if I put <code>scanf(&quot;%[^\n]s&quot;, a)</code> in the while it just runs for one time.
I checked the return value of both scanf and they were the same still.
I didn't get why this is happening...</p>