- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Hotel corridor: unmade rooms
Trick to keep in mind+3 XP
A fresh local is a room nobody cleaned: old junk is still inside.
C++ does not zero a local variable when it is created. It claims a piece of memory that may still contain whatever some earlier code left there, so the value is indeterminate. Giving it a value on the same line removes the problem, and -Wall can warn when you read one that was never set.
Read it once, then a question tests whether the trick stuck.