#defineIt is started by the preprocessor, which is executed before the compiler. After the preprocessor is executed, the code will look like this:
void foo()
{
}
int main() {
printf("%d", 1000);
return 0;
}
And this is what is actually compiled.
A preprocessor is very important for creating header files. In them you see this structure:
#ifndef foo
#define foo
#endif
, . , . , . , . , .
#define dbg_print(x) fprintf(stderr, "%s = %x", #x, x)
, . stdio.h, .
#include <stdio.h>
#define dbg_print(x) fprintf(stderr, "%s = %x", #x, x)
, , stdio.h ? , stdio.h . debug.h :
#ifndef DEBUG_H
#define DEBUG_H
#include <stdio.h>
#define dbg_print(x) fprintf(stderr, "%s = %x", #x, x)
#endif
stdio.h . , . - . . , , . , , .
C : http://www.tutorialspoint.com/cprogramming/c_preprocessors.htm