Created
October 16, 2011 20:07
-
-
Save sachin-handiekar/1291357 to your computer and use it in GitHub Desktop.
Bitwise Operators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* * Operator 4 : Bitwise Operators. */ | |
#include "iostream" | |
#define PRINT(int) printf("%d\n",int) | |
using namespace std; | |
int main() | |
{ | |
int x,y,z; | |
x = 03, y = 02, z= 01; | |
PRINT(x | y & z); | |
PRINT(x | y & -z); | |
PRINT(x ^ y & ~z); | |
PRINT(x & y && z); | |
x = 1; | |
y = -1; | |
PRINT( !x | x); | |
PRINT( ~x | x); | |
PRINT( x ^ x); | |
x = 3; | |
PRINT(y); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment