+ 5
Operator priority order in C++?
Dear all, I don't know Why result of method 1 is 0? (Method 2: OK) Thanks! // #1: #include <iostream> using namespace std; int main() { cout<<0||1&&1; return 0; } Output: 0 // #2: #include <iostream> using namespace std; int main() { cout<<(0||1&&1); return 0; } Output: 1
2 ответов
+ 2
Priority of operators is as follows:-
NOT(!, ~)
AND (&&)
OR(||)