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:

Bitwise operators in C, exercises and examples with solution


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

  Bitwise Operators In C:


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

For more details:- 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.





No comments:

Post a Comment

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