current position:Home>Why is the value of m still given 6? Isn't the if sentence not executed

Why is the value of m still given 6? Isn't the if sentence not executed

2022-02-03 02:39:09 CSDN Q & A

img




Refer to the answer 1:

because m++>5 The judgment of the ,m = 5 The first and 5 Compare , Found not tenable , meanwhile m++ operation , here m=6;
perform else sentence ,m-- Assign first , Again -- So for 6




Refer to the answer 2:



Refer to the answer 3:

because m++>5, It's to compare m>5 Re execution ++ Operation of the
And still else Of printf() Before execution .
So it shows 6. But because m--, It's over m The value is changed to 5 了

You can try if(++m>5) This is the first ++ After comparison




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030239081659.html

Random recommended