Consider a complete decision in C: if (i > 25) { j = i - 25; } else { j = i; }. The controlling expression selects one dependent statement or block, so execution follows exactly one of two paths. section 3.1
if (i > 25) {
j = i - 25;
}
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":3},{\"line\":0,\"ch\":5}]]"}
!@%STYLE%@!
Read the compact form from the outside in: if introduces the condition, parentheses contain the controlling expression, and braces delimit the dependent block. section 3.1
Keep these rules visible when writing or reading conditional logic:
- An if statement runs its dependent statement or block once when the controlling expression is true, and not at all otherwise. section 3.1
- Adding else supplies the alternative path; the if ... else construct selects one of two code paths. section 3.1
- C treats 0 as logical false and every nonzero numerical value as logical true, so if (i) is equivalent in intent to if (i != 0). section 3.1
Skipping the first element
for (size_t i = 0; i < 5; ++i) { if (i) { printf("element %zu ...", i); } } The loop iterates over the range, while the if prevents output when i is zero. section 3.1




















