Pre-processor

At this stage, the macro such as #define, #include and etc are expanded to C code.

For example,

/* hello.c */
#define TXT "hello"

int main(void) {
        printf("%s\n", TXT);
        return 0;
}

Try to compile it with gcc -E:

$ gcc -E hello.c

The entry TXT is replaced the content defined by #define.

Also the marco is being processed by the pre-processor.

By using gcc -E:

For #include, the pre-processor will also expand the expression and put it in code before compilation.

For example,

By using gcc -E :

*Output*

Last updated