title: What is short-circuit evaluation in C?
body: <p>I'm studying C from A Book on C by Kelley-Pohl, and there's this exercise that I don't understand:</p>
  <pre><code>int a = 0, b = 0, x;
  
  x = 0 &amp;&amp; (a = b = 777);
  printf(&quot;%d %d %d\n&quot;, a, b, x);
  x = 777 || (a = ++b);
  printf(&quot;%d %d %d\n&quot;, a, b, x);
  </code></pre>
  <p>They just say to imagine the output and compare it to the real one. I thought the output would have been</p>
  <blockquote>
  <p>777 777 0</p>
  <p>778 778 1</p>
  </blockquote>
  <p>but it is</p>
  <blockquote>
  <p>0 0 0</p>
  <p>0 0 1</p>
  </blockquote>