Spaces between #define arguments
c, c++, macros
Solution
Yes, it's correct. But you should enclose each of the arguments in brackets
#define AVERAGE_NUMS( min_val, max_val ) (((min_val) + (max_val)) / 2)
to avoid operator precedence issues.
Problem
I was confused with the concept that we shouldn't have spaces in `#define` arguments. I think the only restriction is that we shouldn't have spaces between the macro name and the immediate `(` bracket. Am I correct? Am I not supposed to put spaces even inside the `()` brackets? Is the below notation correct ``` #define AVERAGE_NUMS( min_val, max_val ) ((min_val + max_val) / 2) ``` Guys, my above #define C++ statement is just an example. I am actually concerned about spaces while using #define. Anyway Thanks for your answers.