C++ : Define Statements

 

The #define preprocessor directive will tell the preprocessor to do text substitution.

For example, the following directive will substitute every occurrence of FIVE with the number 5:

#define FIVE 5

The #define statement can also do substitution with parameters, allowing you to write simple macros. However, using #define macro substitutions can have many negative side effects. Since C++ has features that make using macros largely unnecessary, we advise that you avoid them.

 

 

© Lynne Grewe