- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 coden
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; }
- Related Articles
- Convert C/C++ program to Preprocessor code
- C/C++ Preprocessor Directives
- Convert C/C++ code to assembly language
- What are the 4 steps to convert C program to Machine code?
- C++ Program to convert the Binary number to Gray code using recursion
- How a Preprocessor works in C/C++?
- What is the #define Preprocessor in C++?
- C++ code to find screen size with n pixels
- C++ code to find tree height after n days
- C++ code to find minimum different digits to represent n
- Java Program to convert ASCII code to String
- 8086 program to convert binary to Grey code
- Python Program to Convert Gray Code to Binary
- Python Program to Convert Binary to Gray Code
- C++ code to find composite numbers whose difference is n
- C++ code to find three numbers whose sum is n

Advertisements