Part & parcel of 'C' (and, let's be honest, any) programming is detection and eradication of BUGS. The digital insectoid we apply our focus to here is variable OVERFLOW and/or UNDERFLOW.
http://cexplorer.gandsnut.net/
Within our 'C' programs, the scope / lifetime of variables concerns us, and can guide the layout of our code. No time better than now to investigate.
http://cexplorer.gandsnut.net/
Besides looking at how to craft statements with more than a single logic test, we sneak in using pointer-to-structure, how it can be passed to a user function. And, our presented code reads a bit silly.
http://cexplorer.gandsnut.net
There is absolutely no shame in converting a program written some time in the past, altering the overall functionality. One might say this is 'hacking' code. Whatever... Retooling saves time, effort - especially when prior code had been tested and confirmed to work. The retooling need only change a small portion of the code.
'C' affords us various ways to add clarity to our code; this is particularly helpful when looking at a source file created weeks or months prior. 'typedef' helps significantly here.
Why not look into looping? So, we investigate 'for()' and 'while()' statements. Tasty tidbits include '++' and '--' (increment & decrement) operators, and we continue with 'printf()' expansion.
http://cexplorer.gandsnut.net
More on our program's use of user data files, expanding the operations we can choose on said files. By the way, at this point, the sophistication of our coding ability has grown quite a bit, and is something to be proud of.
http://cexplorer.gandsnut.net/
Whereas the variables we define in our code consume system memory, it's valuable to have the option to allocate / set-aside in-program memory space. Join in on the exploration.
http://cexplorer.gandsnut.net/