#include <stdio.h>
 
int main() {
 
 
    int a = 1;
    int b = 0;
 
    // Following two statements returns the same output
    printf("\nhah %d", a != 0 & b != 0); // returns 0
    printf("\nhah %d", a != 0 && b != 0); // returns 0
 
    // Despite the common misconception that the statement 1 when written explicitly
    // is this...
    printf("\nmeh %d", (a != (0 & b)) != 0); // returns 1
    // ..., statement 1's AND(&) operator still retain the same operator precedence as its short-circuit cousin(&&)
 
 
    printf("\n");
 
    const int ALT_KEY = 2;
    int input = 1;
     
    // should return 0, it returns 0:
    printf("\nhah %d", (input & ALT_KEY) == ALT_KEY);
 
    // despite the expectation that this "should" return 0, this doesn't return 0:
    printf("\nmeh %d", input & ALT_KEY == ALT_KEY);
 
    // So it means, despite the introduction of short-circuit operator,
    // the non-short-circuit logical/bitwise operator (&,|) still retain their 
    // operator precedence.
    // Hence, the unparenthesized expression (input & ALT_KEY == ALT_KEY), when written explicitly is still evaluated as:
    printf("\nhah %d", input & (ALT_KEY == ALT_KEY) ); // returns 1
 
    // Similar with operator precedence of logical operator:
    printf("\nhah %d", input && ALT_KEY == ALT_KEY ); // returns 1
     
    // Logical operator when written explicitly
    printf("\nhah %d", input && (ALT_KEY == ALT_KEY) ); // returns 1
     
 
 
    printf("\n");
}