The inner expression:
(a < 5) || (c < (a + b))
evaluates a < 5
as false
(since a
is 10
) and c < (a + b)
as true
(since 8
is less than 10+12
). Performing a Boolean “or” operation on false
and true
gives you true
.
And, given that the next thing you do to that value is the !
(inversion), that true
turns into a false
.
solved C++: Why does this logical expression evaluate to false? [closed]