Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C++, let the integer variables m, n, b, a, c and d all have a value, (m = a >;; B) and amp& amp(n = c>b), why is the value of n 1 and the value of m 0 after the operation?
In C++, let the integer variables m, n, b, a, c and d all have a value, (m = a >;; B) and amp& amp(n = c>b), why is the value of n 1 and the value of m 0 after the operation?
& The characteristic of this operator is that when one of the left and right values is false, the whole &; The value of the& expression is false.

And&&It is left-combined, that is, it operates from left to right.

So once the expression on the left is false, the whole &; The value of the & expression is false, and the correct expression will not be processed.

This is also called &; & short circuit

The values of m, n, b, a, c and d are all 1, so a >;; B is false, m = a & gtB=0, so the expression n = c > on the right will not be processed. b,

So the value of n remains the same.