+ 3

Can anyone explain how the value of p is 9

https://code.sololearn.com/cefJ09zohypS/?ref=app

14th Mar 2021, 4:54 AM
Programmer Raja
Programmer Raja - avatar
3 Respostas
+ 7
Keep in mind that all #define do is text replacement at preprocessing stage. So at compile time r+=FNC(++p,q++) Will be converted to r+= (++p>q++)?(++p*q++):(++p-q++) And now I think it should be pretty clear why value of *p* got incremented twice.
14th Mar 2021, 5:53 AM
Arsenic
Arsenic - avatar
+ 3
I think it is because firstly you pass that ++p into FNC, so it was incremented to 8, then "++p" got moved into the FNC body, and incremented to 9
14th Mar 2021, 5:23 AM
Michal Doruch
+ 2
Arsenic is right . The macro you declared above will just copy paste replacing the parameters x, y with ++p and q++.
15th Mar 2021, 5:06 AM
Illa Bahadur Darlami Magar
Illa Bahadur Darlami Magar - avatar