The well-known #define and #if..#endif is no big deal. But from time to
time, we might want to use some features that provided by the CPP.
Concatenation of tokens
All input to CPP are text strings and therefore we can do concatenation of strings like this:
#define NAMEVALUE(x,y,z) x##y(z)
Then by doing
NAMEVALUE(pri,ntf,"hello world\n");
it resolves to
printf("hello world\n");
Quotes
To put stuff as string, we are not using "x" but #x, for example
#define DEBUGPRINT(x) printf("%s = %d\n",#x,x)
Then doing
DEBUGPRINT(x);
will output something like
x = 3
Predefined Macros
__FILE__resolves into the filename of the source code file.__LINE__resolves into the source line number__DATE__and__TIME__resolves into the compile date and time__func__resolves into the function name, only in C99