Convert C/C++ program to Preprocessor code
We use g++ compiler to turn provided Cpp code into preprocessor code. To see the preprocessor code generated by the CPP compiler, we can use the “-E” option on the command line:
Preprocessor include all the # directives in the code. and also expands MACRO function.
Want to learn from the best curated videos and practice problems, check out the C++ Foundation Course for Basic to Advanced C++ and C++ STL Course for foundation plus STL. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
Syntax: g++ -E filename.cpp
// MACRO named MAX initialism to 10#define MAX 10 int main(){ int a = MAX, b = MAX; // Add two values. int c = a + b; return 0;} |
Running the command:
g++ -E geeks.cc
Output :
int main()
{
int a = 10, b = 10;
// Add two values.
int c = a + b;
return 0;
}

