Our first C program, the classic "Hello World" with a few twists.
A point of clarification regarding the libraries (lib) and headers (include) directories: Although programmers often refer to things like "the math library" or "the standard I/O library", it is not true that every header file has a perfectly matching library in the lib directory (e.g., "stdio.lib"). Instead, widely used functions have been gathered together into a "C standard library". Thus, a function such as printf() is defined in stdio.h but is found in this common library. This was done as a point of convenience. Currently, 29 different header files refer to this common library.
In fact, a header file doesn't have to be associated with any library at all. It may just include definitions of constants and similar elements. Another possibility is a header file that you create so that the functions you've written in one file can be called in other files (i.e., your header file would have function prototypes from this file, and then you #include that header in the other files that are going to use those functions).
Final point: a # directive, such as #include, technically is not used by the compiler; it's used by the pre-processor. The pre-processor runs before the compiler and "massages" your code according to these directives and then passes the result onto the compiler.
Text Reference (Embedded Controllers Using C and Arduino): Chapter 3.
My free texts and lab manuals are available for download at my college web site https://www.mvcc.edu/jfiore and at my personal site http://www.dissidents.com
Inexpensive print and kindle copies are available at Amazon https://www.amazon.com/author/jimfiore
If you like my texts and videos, and would like to help defray the costs of making and maintaining them, consider making a modest donation at https://www.buymeacoffee.com/Professo...