Why does this if executes while I have not given any input?
<p>Here is my code snippet:</p>

<pre><code>int a;
if(a=8)
    cout&lt;&lt;"Its right";
else
    cout&lt;&lt;"Not at all";
getch();
return(0);
</code></pre>

<p>I'm getting the output <code>Its right</code> while I've not give any input there its just a assignment to the <code>a=8</code>.</p>

<p><code>**Borland Compiler**</code> gives the following 2 warnings and executes the code.</p>

<blockquote>
  <p>1: Possible incorrect assignment (a=8)</p>
  
  <p>2: 'a' is assigned a value that is never used.</p>
</blockquote>
