I know how the operator works, but I dont understand how the second case in the code below gives a 1 as a result.
#define MIN(a,b) a<b ? a:b
int x = MIN(1,2); //case 1, output is 1
int x = MIN(1,1+1); // case 2
Shouldnt the compiler see this (case 2) as "is 1<1+1?", which I think should be "is 1<1? No it is not", expression 3 is executed and we get: "b" = 1+1 = 2. This is because there are no parentheses around a and b in the macro above, or maybe because I am following my own rules and feel lost? Help please....
Also, how do you explain this case:
int x = MIN(1,2) + 1; //should we consider the "1" on the right?