Working as a lab instructor a lifetime ago, I graded two students' C assignments that both worked (mostly) but clearly without understanding what was going on.
It took me a while to figure out how they worked; as it turned out, they declared the same variables at the top of each function in the same order.
They didn't have globals, they weren't passing values around: the stack was being allocated across the same memory for each function, so the variables "just worked."
Working as a lab instructor a lifetime ago, I graded two students' C assignments that both worked (mostly) but clearly without understanding what was going on.
It took me a while to figure out how they worked; as it turned out, they declared the same variables at the top of each function in the same order.
They didn't have globals, they weren't passing values around: the stack was being allocated across the same memory for each function, so the variables "just worked."