R – way to look at the preprocessor expanded file in C

cc-preprocessorgcc

I want to know how could we look at the C file after it has been expanded by the preprocessor before compilation with all the macro values put in the code inside the function where ever they are used.
Is there a way to do it?

Best Answer

You can ask gcc to do it for you gcc -E yourfile.cpp

That will expand macros and include files, all the preproccessing.