0

Why output is 28 pls explain guys

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

17th Oct 2021, 5:06 AM
Lathesh poojary
Lathesh poojary - avatar
5 Antworten
+ 3
Macro substitution is simple text replacement before it compiles. (28/square(4)) Replace square(4) with 4*4: (28/4*4) Now reduce according to order of operations (left to right in this case): (7*4) (28) Proper macro definition would fix it: #define square(x) ((x)*(x))
17th Oct 2021, 5:41 AM
Brian
Brian - avatar
+ 1
Brian, that is correct. Thanks for the explanation
17th Oct 2021, 5:49 AM
David Akhihiero
David Akhihiero - avatar
+ 1
thanks for explanation🙏🙏
17th Oct 2021, 6:38 AM
Lathesh poojary
Lathesh poojary - avatar
0
I'm no expert in C but it gives the expected result (1) when you enclose square(4) in parentheses; (square(4))
17th Oct 2021, 5:27 AM
David Akhihiero
David Akhihiero - avatar
0
David Akhihiero your right but how it evaluate in this case bro without parentheses
17th Oct 2021, 5:30 AM
Lathesh poojary
Lathesh poojary - avatar