+ 3
How ans is 444
#include<iostream> using namespace std; #define MIN(a,b) a>b?b:a main() { int a=2,b=3,c; c=MIN(++a,++b); cout<<a<<b<<c; }
3 Answers
+ 15
Interesting.
When you "passed" ++a and ++b, the macro acts as:
++a > ++b ? ++b : ++a
In the code, this will cause a to be incremented twice instead of once.
+ 11
@yuri
Tbh, if you want a comment from me, I'd say that the above example shows how macros should be avoided (instead of prefix/postfix operators).
+ 2
the more I know about increments the more crazy I get.
it seems to be on safe side, one should avoid increments as much as possible. C/C++ people can disagree, but it could be a reason why ++ is not in Python.