Apr 8, 2020

Bitwise operators in C, exercises and examples with solution

In the C Programming language, operations can be performed on a bit level using bitwise operators. We use bitwise operators to manipulate data  at its lowest bit level.bitwise operators works on each bit of the data.


Definition: A bitwise operator is an operator used to perform bitwise operations on bit patterns or binary numerals that involve the manipulation of individual bits.
Bitwise operators are used in communication stack.

There are six bitwise operators are in C programming:



Above table shows six bitwise operators used in C programming language.
Which are:


  1. Bitwise AND
  2. Bitwise OR
  3. Bitwise XOR
  4. Bitwise Complement
  5. Bitwise left shift
  6. Bitwise right shift

For more details about:- bitwise operators .




Bitwise operators in C exercise examples:



1. Write a C program which perform bitwise AND operation.

2. Write a C program which perform bitwise OR operation.

3. Write a C program which perform bitwise XOR operation.

4. Write a C program which perform bitwise Compliment(~) operation.

5. Write a C program which perform bitwise left-shift(<<) operation.

6. Write a C program which perform bitwise right-shift(>>) operation.


7. C program to print given number is even or odd using bitwise operators.


Share This:    Facebook Twitter

0 comments:

Post a Comment

If you have any doubts, please discuss here...