Checkpoint: Memory & Lifetime
Challenge on lesson: Checkpoint: Memory & Lifetime
CHALLENGE
Difficulty: intermediate+25 XP
Implement long bounded_total(const long* values, int count, long cap): sum up to count values read through the pointer (stop early once the running total would exceed cap โ in that case return cap). A null pointer with count > 0, or a negative count, must throw std::invalid_argument.
Press Submit to check your solution.
Back to lesson: Checkpoint: Memory & Lifetime