Last active
May 5, 2016 15:31
-
-
Save armaandhir/7384c30719e12cbfc1b09dfae8d4921a to your computer and use it in GitHub Desktop.
Simple implementation of & bitwise operator
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
/* | |
* Simple implementation of & bitwise operator | |
*/ | |
#include <stdio.h> | |
#define TUNA_A 1 | |
#define TUNA_B 2 | |
#define TUNA_C 4 | |
#define TUNA_D 8 | |
void main(){ | |
int test1 = 3; | |
int test2 = 7; | |
int test3 = 8; | |
int test4 = 12; | |
if(test3 & TUNA_A){ | |
printf("TUNA_A\n"); | |
} | |
if(test1 & TUNA_B){ | |
printf("TUNA_B\n"); | |
} | |
if(test1 & TUNA_C){ | |
printf("TUNA_C\n"); | |
} | |
if(test3 & TUNA_D){ | |
printf("test1 TUNA_D\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment