Skip to content

Instantly share code, notes, and snippets.

@armaandhir
Last active May 5, 2016 15:31
Show Gist options
  • Save armaandhir/7384c30719e12cbfc1b09dfae8d4921a to your computer and use it in GitHub Desktop.
Save armaandhir/7384c30719e12cbfc1b09dfae8d4921a to your computer and use it in GitHub Desktop.
Simple implementation of & bitwise operator
/*
* 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