I'd like to know if someone knows the way a compiler would interpret the following code:
#include <iostream>
using namespace std;
int main() {
cout << (true && true || false && false) << endl; // true
}
Is this true because && has a higher precedence than || or because || is a short-circuit operator (in other words, does a short circuit operator disregard all subsequent expressions, or just the next expression)?
&&
has a higher precedence than ||
.