To see preprocessor output before compilation, use the -E switch:
gcc -ansi -E program.c > program_post.c
The above command pipes the pre-processor output into a file which you can view with:
cat program_post.c | more
Here's a sample C program with three #defines used within main():
pre.c (and it's output when executed)
Here's the file directly after preprocessing. It has a lot of preprocessor comments that clutter things up, so it's not all that helpful:
pre0.i (the preprocessor pulled in the full contents of /usr/include/stdio.h)
Here's the preprocessed source file with all added comments removed (only code added by the preprocessor is left). You can see that the #include <stdio.h> added all the function prototypes for the standard IO library, even though this program only needs the prototype for the printf function:
And finally, here's the preprocessed source file with all unused code removed (stripped to it's bare essentials). Now you can easily see the effect of string substitution due to the #define NUMVALS 10 in the original source code:
pre2.i