+ 1
#define( macro) order of execution.
Could anyone please explain Me. How the code below, executes. Means, what's the order by which each line/statement executes. I thought the output should be : 11 6 11. But it's 12 6 11?... https://code.sololearn.com/cTfE5Mit5Qmk/?ref=app
2 Answers
+ 3
Macros work differently from functions.
"Macro expansion" is like a dumb copy-paste.
After macro expansion, your line 6 becomes:
k=((i++)>(j++)) ? (i++):(j++);;
Which should explain the strange result. (Also note the extra ";" !)
When using macros you always have to be extra careful.
+ 1
Thanks Schindlabua...