+ 2
Which has higher priority over && and || operator?
like what will be the output of 0 && 1 || 1 it may be either 0 if started from || operator or may be 1 if started from && operator.
9 odpowiedzi
+ 8
I've tested with Code Playground and I have obtained 1. You might have to check your code syntax.
+ 7
Tsk, your code outputs zero because cout prints what comes next directly, like return. To clear up the confusion, place brackets to your entire statement after cout.
cout<<(0 && 1 ||1);
+ 6
0 && 1 || 1 should end up being 1.
+ 6
I agree with Hasty. Can we see your code?
+ 2
Thanks @hatsy rei.
It was my silly mistake.
+ 1
You could check my code "operator".
Plz it's giving 0 as output.
0
@Nina
But when I tried it in code playground it results in 0.
0
@hatsy
It also says && has higher priority over || so answer would be 1 but it gives 0.