Difference between Logical Negation and Bitwise complement

Version 1
    Question: What is difference between logical negation and bitwise complement ?



    Logical negation is represented as '!' and bitwise complement is represented as '~'. The logical negation evaluated over the entire Byte.  If the value is non-zero, then the logical negation results in zero.  Whereas, bitwise compliment compliments each bit in the byte.  Logical negation and bitwise compliment are completely different operations.  For example consider the following code snippet:

    void main( void )


       BYTE A = 0x01;
       BYTE B = 0x02;

       // Define 2LEDs

       // Switch off all the LEDs

       // As the value of A is non-zero, a logical negation results in zero.
       // The expression evaluates as (0x00 & 0x02)=0x00 hence LED 1 is OFF
       if(!A & B)

       // Bitwise compliment of 0x01 results in 0xFE
       // The expression evaluates as (0xFE & 0x02)=0x02 hence LED 2 is ON.
       if(~A & B)