Skip to main content

Practice · 1 of 1

Swap Two Variables

CHALLENGE
Difficulty: beginner+25 XP

Implement swapThem(a, b) so that after it runs, a holds the old b and vice versa. (Yes, std::swap exists — write it by hand once so you feel the assignment semantics.)

Back to lesson: Practice: Variables Practice