Logical operators 11

1, used to connect multiple conditions (in general, it is the relationship between expression), the end result is either true (non-zero representation) or false (0)

2, a list of logical operators

  A variable assuming the value 1, the variable B is 0, then:

  

. 1 #include <stdio.h>
 2  void main () {
 . 3      int A = 10 , B = 99 ;
 . 4      IF (A < 2 && ++ B> 99 ) {
 . 5          the printf ( " OK100 " );
 . 6      }
 . 7      the printf ( " B = D% " , B);
 . 8  
. 9      // print result: B = 99
 10      // . 1, && during operation, if the first condition is false, the latter condition is no longer determined
 11      @ 2, this phenomenon is called a short circuit, it is also referred to as short-circuit logic and logic 
12 }

 

  

 

Guess you like

Origin www.cnblogs.com/shanlu0000/p/12339970.html