Home > Back-end >  C language small white for help! Could you tell me how to understand the problem?
C language small white for help! Could you tell me how to understand the problem?

Time:01-20

If there is int a=7, b=5, c; Execute statement c=(a=3) | |=2 (b); After, a value is ___3__, b value of ___5__, c value is __1___,

CodePudding user response:

We know that the integer as logic, nonzero is true, zero is false;
Whereas the logic value as an integer, the true value of 1, false value is 0;
Logical operators & amp; & And | | in the left operand can determine the result when short circuit skip right operand,

CodePudding user response:

C is the result of the true and false, 0 for false and 1 is true,

Note | | if | | to the left of the expression is true, | | behind the expression will not perform; So called short circuit value;

So b=2 do not perform, so b=5,

  • Related