Preprocessor Flashcards
What happens when we compile a piece of C code?
A temp file is generated, this is to perform textual transformations on the code.
This file is then used to create the executable program.
What is the purpose of the temp file, when compiling C programs?
It includes headers to access code defined in other source files
It expands macros
Conditionally enable/disable bits of code
What should header files contain?
Declarations ONLY
NO Definitions
What are Macros?
These are Textual Substitutions
They are useful for defining compile time constants
How would I compile a program consisting of multiple source files?
For each source (.c) file, create a header file that exposes the interface of the module
Create an object file for each source file
Link the object files to create the executable
What key word can I use to make sure a function/variable is only used in the file it is declared in?
The static keyword