Macros are extended; they have no values passed to them. See that your macro expands in an instruction that assigns k .
k=(p+1*p+1);
Prefer functions for macros, if you need to use a macro you have to do is copy the parameters completely. Note that even this one has potential surprises if users use it with expressions that have side effects.
#define PROD(x) ((x)*(x))
Charles Bailey
source share