Macro Parentheses in C – Why SQ(2 + 3) Gives 11, Not 25

A macro that squares a number — what could go wrong? Everything, because the preprocessor doesn’t square numbers; it pastes text. This question from our C Programming Quiz App is the canonical macro trap, the one that turns SQ(2 + 3) into something that isn’t 25 — and the reason every style guide screams “parenthesize …

Switch Fallthrough in C – What Happens Without break

The switch matched case 5 — so it runs case 5’s code and leaves, right? Not in C. This question from our C Programming Quiz App is about fallthrough, the single most surprising rule of the switch statement, responsible for decades of bugs and one legendary telephone-network outage. The Quiz Question int x = 5; …

The continue Statement in C – Why the Loop Prints 0 2

continue and break both bail out of something — but out of what, exactly? Mixing them up changes a loop that skips one item into a loop that abandons everything. This question from our C Programming Quiz App pins down what continue skips, what it doesn’t, and the one loop where it behaves differently than …

Post-Increment in a while Condition – Why i++ < 3 Prints 1 2 3

The loop starts at 0 and the condition says “less than 3” — so it prints 0, 1, 2. Right? Wrong, and by two different one-off errors at once. This question from our C Programming Quiz App puts a post-increment inside a while condition, where its when-does-it-happen semantics decide both the first value printed and …

Assignment vs Comparison in C – The if (x = 0) Bug

x is 10 — clearly not zero — yet this if doesn’t do what it looks like it does. One missing = turns a comparison into an assignment, and it’s arguably the most famous typo in C. This question from our C Programming Quiz App checks whether you can spot it — and whether you …