The problem is that wait_for sends the main() function into a wait state as well, of which you are aware, and then after wait_for a new variable with the same name and value is "allocated" (check their pointers with printf).
The solution or workaround rather is to better not use wait whenever you can in my opinion (or make it a global variable/ object if you have to).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends