Practice · 3 of 5
Watch the Optimizer Fold
CHALLENGE
Difficulty: advanced+25 XP
Implement int folded(void) whose body computes 21 * 2 through plain automatic locals and returns it. Then implement int unfolded(void) doing the same multiplication but through a volatile int. Return the difference folded() - unfolded(); it must be 0 (folding changes nothing observable), which is the standard's own guarantee.
Press Submit to check your solution.
Back to lesson: Practice: Sequencing and Lifetime Drills