The following code std::cout << (0 < 5 < 2);
outputs 1
(true) to the console, even though mathematically speaking, 5 < 2
is false. What is the logic behind this?
Hypothesis: This is because 0 < 5
is calculated as 1, therefore 0 < 5 < 2
is calculated as 1 < 2
. Am I correct?