Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - This is a function to judge the number of palindromes. My question is the literal meaning of 1 while(m)。 2. How to execute while (m) in memory?
This is a function to judge the number of palindromes. My question is the literal meaning of 1 while(m)。 2. How to execute while (m) in memory?
While(m) is a loop statement, which literally means to judge whether the value of m is true or false. If m is not zero, that is to say, m is true, the contents in the following {while(m) will be executed. If m is false, the content in {} under while(m) will be skipped, and the following statements will be executed, such as if (sum == val) in the title.

If the value of val is 3 1, then m = valm is 3 1, and m is a non-zero value, so the statement in {} after while(m) is executed, and the last sentence in braces is m/=10; So after executing 1 times, m becomes 3, and then 3 is brought into while(m), and m is still a non-zero value, so the statement in {} after while(m) is executed again, and then m becomes 0, and then 0 is brought into while(m), so m is false to exit the while(m) loop and execute the following if.