Honeslty have no idea on how is the output being generated ? Code: int main(int argc, char** argv) { int i=1,j=-1,k=0,l=2,m; m=i++||j++&&k++; printf("%d %d %d %d %d",i,j,k,l,m); return 0; } output : 2 -1 0 2 1 evwn though j++ is is present that value is not being incremented
Though evaluation of expression varies from compiler to compiler, but generally it will be from left to right. The evaluation of logical operation is done as per truth table, which suggests that for OR operation any one operand yielding to true results the expression to be true. So, only first operand of the OR operation was enough for evaluating the result of the expression. The OR and AND operations are having the same priority.