title: How does the increment operator work in an if statement?
body: <pre><code>    #include &lt;stdio.h&gt;
  
      int main()
      {
          int x = 0;
  
          if (x++)
              printf("true\n");
          else if (x == 1)
              printf("false\n");
          return 0;
      }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>false
  </code></pre>
  
  <p>Why is the output false?</p>
  
  <p><code>x++</code> is post increment; this means that the value of <code>x</code> is used then it is incremented.
  If it is so, then <code>x=0</code> should be used and the answer should be true.</p>