I have an exam question about the ambiguity of if then else.
Code:
#define testNeg(x) if (x>0) printf("Ouuch\n")
if(a>b)
testNeg(x)
else
printf("Arragh\n");
printf("Thank you");
When a is 4 and b is -3, the result is
Arragh
Thank you
When a is 4 and b is 3 the result is
Oouch
Thank you
When a is -4 b is -3 the result is
Thank you
But not
Arragh
Thank you
I dont understand how such result is outputted in case3. and by inserting the block characters (curly braces), can someone show me the two versions of matching else to the two ifs. (one version for one if)