What is a preprocessor and what will it do for a program?

Updated on September 1, 2017

A preprocessor directive is a statement (such as #define) that gives specific instructions on how to modify the source code. It is invoked as the first part of the compiler program’s compilation step. It is usually hidden from the programmer because it is run automatically by the compiler.

The preprocessor reads in all of your include files and the source code that are compiling and creates a preprocessed version of the source code. This version has all of its macros and constant symbols replaced by their corresponding code and value assignments. If the source code contains any conditional preprocessor directives (such as #if), the preprocessor evaluates the condition and modifies the source code accordingly.

Was this article helpful?

Related Articles

Comments Leave a Comment

  1. thanks for the suggestion keep posting the best answers.

Leave a Comment