There are many different usage for the C/C++ preprocessor, but first of all, heres a little background on what they are, and what theyre used for.
The preprocessor works as a script language for the C/C++ complier, for example there are a if command in the preprocessor for C/C++ and only if the condition is true the code within the if will be complied... So you see some of the usage area's now...
Someof the usage of the C/C++ preprocessor can be to make you code multiplatform, so the source code "change" after what platform is being complied on. :)
All of the C/C++ preprocessors start with a #.
The #include preprocessor.
Didn't think this was a preprocessor did'nt you?
Anyway this preprocessor works thte way that it include the file specified to the current source file, if the file that will be included exist in the same directry in a didrectory "neer" the file the " can be used insted of:
Syntax(defualt): #include
Syntax(local): #include "filename"
The #define, #undef preprocessor.
The #define preprocessor can be used as a variable. the "only" different is that a #define must be #undef before it can be re #define'd, it don't have to be asigned a value but then it will just "return" true, it can also be used to creath a "function", the thing that the #define really do is that it replace itseld with the code/value that's it been asigned in the source code.
Variable Syntax: #define name value
Function Syntax: #define function(variables) code
Syntax: #undef name
The #if,#else,#ifdef,#ifndef,#elif,#endif preprocessor
The #if preprocessor works almost like an normal if condition in the C/C++ language. If the condition is true then is complie the code inside the #if, the #else is to be placed before the #endif and it is just what it sounds if the first #if condition is'nt true then it complie the code inside the #else. O yeah, the #endif end the #if started. the #elif is a "else if" statement it works as an #if just that it must be placed inside a #if and only become "tested" if the first #if is not true or if a #elif before is not true. The #ifdef works as a #if that only check if something is #define'd, just the ended with a #endif. The #ifndef works the opposite way as the #ifdef exapt that it must be ended with a #endif too.
Syntax: #if VARIABLE boolean VARIABLE
Syntax: #ifdef VARIABLE
Syntax: #ifndef VARIABLE
Syntax: #elif VARIABLE boolean VARIABLE
Syntax: #else
Syntax: #endif