For 1, I'd like for you to think you're telling a story, one that is really air tight and unambiguous. If you think putting all the calls in main() can help you tell that story, then so be it.
For 2, of late industrial software development has largely moved to keeping variables as local as possible so its easier to express provenance. This has been the case for at least a good 3-4 decades now.
At no extra cost, I'd like to give you an unsolicited advice. If you're using modern, real C compilers like gcc or clang, I'd strongly recommend you pass -Wpedantic -pedantic-errors -Wall -Wextra on the command line.
gcc -Wpedantic -pedantic-errors -Wall -Wextra -Werror program.c
and if you're using clang, also pass -Wmost along with the rest. Learning C is one thing. But following the standard rules right from the start, it will save you from unexpected grief later on. If you try compiling your code under these flags now, it will refuse to compile. I'd suggest you try fixing as much as you can, then go back to compiling the normal way until you get a hang of things.
I'd recommend not to alias compilers like that. Rather, if you're interested, you could just use a simple Makefile like shown below and get it over with. Save it into a file called
Makefile(yes, uppercase M followed byakefileall lowercase) in the same directory as yourprogram.cfile.Note, I have used
-std=c89but you can delete that line or maybe even use a more modern standard such as-std=c23if you like. If you delete, both gcc and clang will default to the latest ISO standard supported by that version of compiler.Also since you're compiling only a single file, I have used
program.cas input producingprogramexecutable on UNIX. To run thisMakefileyou need to invokemakefrom the same directory asMakefileon command-line as:to enable all the warnings and compile. If you set
W=0it will not warn or even print any diagnostic unless compiler really cannot generate the executable. You can also passD=0for optimised/release build,D=1for debug build so you can backtrack ingdb. You can also passA=1if you want address sanitisers enabled. It will report if your program is touching or even looking at pointers/memory regions the wrong way, leaking memory or just generally doing operations that cannot guarantee correct behaviour. PassingV=1will display the exact command executed to compile, otherwise it will silently compile.Here's the full
MakefileI use: