0
anybody explain the ouptput...
3 Answers
+ 2
The boolean operator || checks if one or both statements are true, what it does is that if the first statement is true it doesn't even bother to check the other one because if one is true then it returns true. So it increments x and x is true (idk why it's true I don't know C++ but the operator acts the same in Java) and it doesnt bother to check the other operators, hence why y and z isn't incremented. It then prints out x x y and z.
+ 2
AFAIK in C/C++ any non zero integral number is considered as true. They can be used in place of boolean.
+ 2
Check the below code.
https://code.sololearn.com/csEhhKrj9RRN/?ref=app