Back
Close

Quiz 34

Anonymous
1,132 views

description:

If the first operand to the logical AND operator evaluates to false the second operand is guaranteed not to evaluate. Note: the logical OR operator is guaranteed not to evaluate the second operand if the first operand is true. Note: for the logical AND and OR operators, all side effects of the first expression, except for destruction of temporaries, happen before the second expression is evaluated.

#include <iostream>
int main(int argc, char** argv)
{
int x = 0;
int y = 0;
if (x++ && y++)
{
y += 2;
}
std::cout << x + y << std::endl;
return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants