Bitwise Operators in C, all in one

C Programming Language / Operators and Enums in C Language

1205

Program:

#include"stdio.h"
void main() {

   unsigned int a = 12;	  
   unsigned int b = 15;	 
   int c = 0;           

   c = a & b;        
   printf("Value of c is %d\n", c );

   c = a | b;        
   printf("Value of c is %d\n", c );

   c = a ^ b;       
   printf("Value of c is %d\n", c );

   c = ~a;           
   printf("Value of c is %d\n", c );

   c = a << 2;     
   printf("Value of c is %d\n", c );

   c = a >> 2;     
   printf("Value of c is %d\n", c );
}

Output:

Value of c is 12
Value of c is 15
Value of c is 3
Value of c is -13
Value of c is 48
Value of c is 3
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.