Macro Clamp
Challenge on lesson: Checkpoint: Preprocessor
CHALLENGE
Difficulty: beginner+25 XP
Define #define CLAMP(v, lo, hi) as a do-while(0) statement macro that modifies v IN PLACE to lie within [lo, hi], and implement int percent_band(int v) returning 0 when v <= 0, 100 when v >= 100, and v otherwise.
Press Submit to check your solution.
Back to lesson: Checkpoint: Preprocessor