Convert C/C++ program to Preprocessor code
Last Updated :
29 Aug, 2018
Improve
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.
CPP
Running the command:
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;
}
13
1
// MACRO named MAX initialism to 10
2
3
4
int main()
5
{
6
7
int a = MAX, b = MAX;
8
9
// Add two values.
10
int c = a + b;
11
12
return 0;
13
}
g++ -E geeks.ccOutput :
int main() { int a = 10, b = 10; // Add two values. int c = a + b; return 0; }