The C pre-processor runs on your C and C++ code at compile time prior to the main compile process. Source lines starting with the # character are processed to roduce a new source code file (internally - you don't normally see this) which is then the input to the compile process "proper".
Preprocessor DIRECTIVES include:
To include the contents of another file at this point. If the other file is embedded in chevrons (< to >), the included file is a standard system one from system libraries, but if it's embedded in double quotes, it's your own include file from your own folder / directory. Include files often have an extension .h
for header, but this doesn't matter to C / C++ - it's just a label
Define a variable within the pre-preocessor. Subseqent refefences to that named variable will be substituted for the value given at compile time, allowing you to fix data at a specific build - such things as array sizes. It's convention to write preprocessor variable name all in CAPITALS to help the maintenance programmer, but it's not a vital rule.
Preprocessor variables can also be set on the compile time command line; in cc
, that's done with the -D switch.
Allow you to check whether a variable has been defined - very useful to see ig your file has been brought in by another file at compile time, or is being compiled on its own. Also useful for conditional code based on compile time selection, and to avoid code being loaded twice where there's a comple #include structure. "ifdef" is "if defined" and "ifndef" is "if NOT defined".
Signifies the end of a block started by "ifdef" or "ifndef".
Note that directives do NOT end with a semicolon character - they are a different language to C and C++, and they end at the end of the line.
Example - [here]
. (written 2015-10-27)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesC201 - C and C based languages - C Language Fundamentals 
C - why is slow to write and debug) but fast to run? - (2015-11-01) 
Learning to program - variables and constants - (2014-11-22) 
BODMAS - the order a computer evaluates arithmetic expressions - (2012-11-09) 
Integer types, and integer overflows, in C - (2012-01-25) 
Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java. - (2011-05-05) 
Your program - you just provide the filling in the sandwich - (2011-04-08) 
Learning to write good programs in C and C++ - separating out repeated code - (2011-01-04) 
Staring a C course with Hello World - why? - (2010-06-30) 
What does const mean? C and C++ - (2010-01-15) 
Variables and pointers and references - C and C++ - (2009-01-23) 
Compiling C programs with gcc - an overview - (2008-06-10) 
Turning C from source to a running program - (2006-10-06)C204 - C and C based languages - Functions, Macros and programs in multiple files 
Function prototype - what they are and why you should use them - C and C++ - (2015-10-27) 
Passing information into functions in C - by name, by value - (2015-10-26) 
Passing arrays into functions in C - (2014-12-02) 
Naming blocks of code, structures and Object Orientation - efficient coding in manageable chunks - (2012-05-06) 
Returning extra results from a function in C - (2012-05-03) 
Using functions to keep look and feel apart from calculations - simple C example - (2011-04-09) 
C Course exercise and sample answer - source in 2 files - (2010-06-30) 
Sharing variables between files of code in C - extern - (2010-01-14) 
Function Prototypes in C - (2010-01-11) 
Some new C programming examples - files, structs, unions etc - (2007-12-19) 
A better alternative to cutting and pasting code - (2007-04-26) 
Do not duplicate your code - (2006-06-23)C230 - C and C based languages - Revision of C 
Moving from C to C++ - Structured to Object Oriented - a lesson for engineers - (2015-03-28)
Some other Articles
When do I use the this keyword in C++?Well House Consultants - Python courses / what's special.Strings in C - strncmp strncpy and friendsPreprocessor directives in C and C++ - what they meanRUby - loading, using, changing, storing JSON format dataScenario outlines - tables of values to test - in Gherkin / CucumberTesting your new class - first steps with cucumberBuild up classes into applications sharing data types in Ruby