Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Why is num filled in while brackets instead of num>=0?
Why is num filled in while brackets instead of num>=0?

While (num) means

If num is not equal to 0, it will continue to loop

While (num>=0) means (num> =0) This condition is true to loop

When num is an unsigned integer

The execution results of while(num>0) and while(num) are the same, but The judgment conditions are different

For example, the results are different when it is a signed integer

Note that yes>no>=