#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
printf("Hello World");
int a = 10, b = 20, c= 30, d = 40;
int e = ++a || ++b || ++c && ++d; // DoubtFull Line
cout<<"a = "<<a<<" b = "<<b<<" d = "<<d<<" c = "<<c<<" e = "<<e;
return 0;
}
Consider the code and consider the precedence table given in the link:-
http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm
As per the link mentioned in the above, && operator has higher precedence than $||$, and using the short circuit, first
++c && ++d
will execute which and return true.
Now the expression should be "++a || ++b || TRUE" in this using the "short circuit principle "only ++a will execute but ++b will not so the final Output should be:-
a = 11 b = 20 c = 31 d = 41.
but the output is
a = 11 b = 20 c = 30 d = 40