+ 3
#define is a preprocessor macro that replace all occurences of a given identifier with a value right before the compilation. In other words, it's text replacement. You can even put expressions like #define SQR(x) (x)*(x) to replace SQR(2+3*4) by (2+3*4)*(2+3*4) for example. Constant variables are type-checked by the compilator and are subject to normal variable rules. You can get the address of the variable, for example. You may choose either to handle constant values, there is no significative performance difference. Using const may be better since you make the variable known to the compilator.
18th Sep 2016, 9:45 AM
Zen
Zen - avatar