Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Conversion between Integer and Boolean Type in C Language
Conversion between Integer and Boolean Type in C Language
0 or 1

The true or false values of Boolean variables in c++ are 1 or 0.

Any number except 0 means true, and only 0 means false.

Therefore, assigning any non-zero integer variable to a Boolean variable will get true (that is, 1).

Only by assigning an integer variable with a value of 0 to a Boolean variable will you get false (that is, 0).

Then assign it back to the integer variable to get 0 or 1.