<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Short-circuit evaluation - Page 13 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=Short-circuit_evaluation&amp;p=12">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Short-circuit_evaluation&amp;p=14">3.Next</a>
</p>
<p>language:<syntaxhighlight lang="c">int denom = 0;if (denom != 0 && num / denom) {    ... // ensures that calculating num/denom never results in divide-by-zero error   }</syntaxhighlight></p>

<p>Consider the following example:<syntaxhighlight lang="c">int a = 0;if (a != 0 && myfunc(b)) {    doSomething();}</syntaxhighlight></p>

<p>In this example, short-circuit evaluation guarantees that <code>myfunc(b)</code> is never called. This is because <code>a != 0</code> evaluates to false. This feature permits two useful programming constructs.</p>

<p>
#</p><p>
<a accesskey="1" href="page.php?w=Short-circuit_evaluation&amp;p=12">1.Previous</a><br />
<a accesskey="3" href="page.php?w=Short-circuit_evaluation&amp;p=14">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
