
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert C/C++ Program to Preprocessor Code
Here we will see how to generate the preprocessed or preprocessor code from the source code of a C or C++ program.
To see the preprocessed code using g++ compiler, we have to use the ‘-E’ option with the g++.
Preprocessor includes all of the # directives in the code, and also expands the MACRO function.
Syntax
g++ -E program.cpp
Example
#define PI 3.1415 int main() { float a = PI, r = 5; float c = a * r * r; return 0; }
Output
$ g++ -E test_prog.cpp int main() { float a = 3.1415, r = 5; float c = a * r * r; return 0; }
Advertisements