

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Pointer-Pointers
incomplete
2: Array of Pointers
incomplete
3: Void Pointers
incomplete
4: Swapping Integers
incomplete
5: Swapping Strings
incomplete
6: Generic Swap
incomplete
This lesson's interactive features are locked, please to keep using them
Sneklang makes it easy to swap two values:
cool_person = "Lane"
uncool_person = "TJ"
cool_person, uncool_person = uncool_person, cool_person
print(cool_person) # TJ
print(uncool_person) # Lane
# (get rekt lane)
Before we do something more tricky, let's start with just swapping some integers. Complete the swap_ints function. It accepts two pointers to integers, and should swap the values of the integers they point to.
You'll need to use a temporary variable to store one of the values while you swap them.