What should be the answer?
@DAWID15 what is answer ??? and kindly say is kabir bhaiyya correct.
Yes he’s right. The answer is C.
Thanks @Kabir5454
The answer will be (C) . Macro sometimes also called by the name unsafe function as it may evaluate its argument more than once . Here given , $a=10$ , $b=11$, $c=12$. The definition of the macro is , #define greater($x$,$y$) $(x)>(y)$ ? $(x) :(y)$ $c$=greater$(a++$,$++b)$ now the invocation of the macro looks like , $c= $($a++$)>($++b$)$ ? $($a++$) :($++b$) so 1)first a increment to 11 . 2) b increases to 12 3) comparison occurs between them . 4) as 12 is greater that 11 so , $++b$ will be our answer. 5) due to $++b$ value of b again increases to 13 . 6) we assign value of $C=13$ . so our required answer will be option (C) .
ref: – https://wiki.sei.cmu.edu/confluence/display/c/PRE31-C.+Avoid+side+effects+in+arguments+to+unsafe+macros
64.3k questions
77.9k answers
244k comments
80.0k users