Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language: If the value of the integer variable X is 8, what is the value of the expression X%=X%= 1?
C language: If the value of the integer variable X is 8, what is the value of the expression X%=X%= 1?
1) First of all, this is an undefined behavior, and changing the value of an object twice between two consecutive points is an undefined behavior.

2) Secondly, no matter which x is found first, the result is 0. If the left x is calculated first, the middle x is 0% 1, and the result in the compiler is 0. If the middle x is calculated first and the result is 0, then when the left x is calculated again, the denominator will be 0 and the program will crash. As for which to evaluate first, it is up to the compiler to decide, and the result is nothing more than 0 or crash.