Preprocessors: #define
Applies To: C++Builder 1 or higher
Category: C++ Language
- The #define directive causes the compiler to replace one piece of text with another:
-
- #define text_1 text_2
-
- For example, if you want to replace VALUE with 100, you can use:
-
- #define VALUE 100
- x = VALUE;
-
- You can also create function macros with #define:
-
- #define DOUBLE(x) ((x)*2)
-
- It is important to parenthesize the macro function and the parameters used in it to make sure that they work properly.
C++Builder Developer's Network
Copyright © Yoto Yotov