Bitwise Operator
Bitwise Operator
Copy and paste the following C++ program in test.cpp file and compile and run
this program.
#include <iostream>
main() {
int c = 0;
c = a | b; // 61 = 0011 1101
c = a ^ b; // 49 = 0011 0001
return 0;
When the above code is compiled and executed, it produces the following
result −
Line 1 - Value of c is : 12
Line 2 - Value of c is: 61
Line 3 - Value of c is: 49
Line 4 - Value of c is: -61
Line 5 - Value of c is: 240
Line 6 - Value of c is: 15