Logical operator's

The logical operator is a valid combination of logical values, variables and operators. The logical values can be combined with relational operators.

                      Note : The logical operators also written either ONE or ZERO.


      Logical NOT( ! ) 

  
    A

   R
  
     0                     
  
    1
  
     1

    0










       Logical AND ( && )
        
A
B
R
  0
  0
  0
  0
  1
  0
  1
  0
  0
  1
  1
  1











        Logical OR ( || )
         
A
B
R
  0
  0
  0
  0
  1
  1
  1
  0
  1
  1
  1
  1











 EXAMPLES : 

 NOT :-
                 a = !1 ===> 0
                 a = !0 ===> 1

OR :-
                main( )
               {
                    int a;
                    a=5>4 | | 7>9;
                    printf("%d",a);
                    getch( );
                }

  output :
1   ( According to OR operator before condition is satisfies, it does not check the remaining   expression )

  AND :-           
              main( )
             {
                   int a;
                   a=5>9 && 7>2;
                   printf("%d",a);
                   getch( );
              }
  
 output :
0   ( According to AND operator before condition is dissatisfies, it does not check the  remaining expression )