UMM-CSci-Systems / C-programming-pre-lab

Pre-lab to get started on compiling and running C programs and valgrind
MIT License
0 stars 2 forks source link

Move variable declarations #11

Closed helloworld12321 closed 2 years ago

helloworld12321 commented 3 years ago

So that they're closer to where they're used, instead of all being at the top of the function.

Closes #9.

NicMcPhee commented 2 years ago

Thanks for doing this!

Your changes help make it clear that there really ought to be some helper functions there that handle those key steps, and the variable declarations would move into those helper functions. The arguments and returns would be a little awkward, though, since we'd be passing around and allocating arrays a lot. Not sure if that would make it more or less confusing for students.