Open In App
Related Articles

Convert C/C++ program to Preprocessor code

Improve Article
Improve
Save Article
Save
Like Article
Like

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.

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;
}
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 29 Aug, 2018
Like Article
Save Article
Previous
Next
Similar Reads