Listing 1 Illustrates bitwise operators

/* bit1.c */

#include <stdio.h>

main()
{
   unsigned char a = 0x55;
   unsigned char b = 0xf0;
   
   printf("a | b == %02X\n",a | b);
   printf("a & b == %02X\n",a & b);
   printf("a ^ b == %02X\n",a ^ b);
   printf("~a == %02X\n",(unsigned char)~a);
   printf("a << 1 == %02X\n",a << 1);
   printf("b >> 6 == %02X\n",b >> 6);
   return 0;
}

/* Output:
a | b == F5
a & b == 50
a ^ b == A5
~a == AA
a << 1 == AA
b >> 6 == 03
*/
/* End of File */