title: Efficiency of boolean comparisons? In C
body: <p>I'm writing a loop in C, and I am just wondering on how to optimize it a bit. It's not crucial here as I'm just practicing, but for further knowledge, I'd like to know:</p>
  
  <p>In a loop, for example the following snippet:</p>
  
  <pre><code>int i = 0;
  while (i &lt; 10) {
      printf("%d\n", i);
      i++;
  }
  </code></pre>
  
  <p>Does the processor check both <code>(i &lt; 10)</code> and <code>(i == 10)</code> for every iteration? Or does it just check <code>(i &lt; 10)</code> and, if it's true, continue?</p>
  
  <p>If it checks both, wouldn't:</p>
  
  <pre><code>int i = 0;
  while (i != 10) {
      printf("%d\n", i);
      i++;
  }
  </code></pre>
  
  <p>be more efficient?</p>
  
  <p>Thanks!</p>