Skip to main content

Practice ยท 2 of 5

Fix the Unsequenced Sum

CHALLENGE
Difficulty: advanced+25 XP

This expression is UB: int k = i++ + i++;. Implement int sequenced_sum(int start) returning the value that start + (start+1) computes, but built WITHOUT any unsequenced pair: use temporaries or separate statements. Your submitted source is exposed as sequenced_sum_src (a string constant you also define) so the checker can verify it contains no ++ at all.

Back to lesson: Practice: Sequencing and Lifetime Drills