C Program output confusion

c

Solution

Because `==` has a higher precedence than `&&` So first this get's evaluated:

x && (y == 1)
y == 1  // 2 == 1
//Result: false

Which is false and then second:

x && false  //1 && false
//Result: false

So the if statement will be false

For more information about operator precedence see here: http://en.cppreference.com/w/cpp/language/operator_precedence

Problem

Can someone explain why the output of this program is false?? x && y gives 1. Still the output is false. ``` #include <stdio.h> int main() { int x = 1, y = 2; if(x && y == 1) { printf("true."); } else { printf("false."); } return 0; } ```

Original source