Skip to main content

Practice · 2 of 3

Statement Macro

CHALLENGE
Difficulty: beginner+25 XP

Define #define INCREMENT_IF(var, cond) as a do-while(0) statement macro that increments var only when cond is true. It must be usable as a single statement (with a trailing semicolon) even inside if/else.

Back to lesson: Practice: Organization Practice