Skip to main content

Practice · 2 of 3

Swap with a Temp

CHALLENGE
Difficulty: beginner+25 XP

Implement void swap(int* a, int* b) that exchanges the two ints through the pointers using a temporary. (Full pointer theory comes in module 11; for now the pattern *a means "the int a points at".)

Back to lesson: Practice: Value Surgery