Advertisement
Guest User

Untitled

a guest
May 5th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. /*
  2. * Simple implementation of & bitwise operator
  3. */
  4.  
  5. #include <stdio.h>
  6.  
  7. #define TUNA_A 1
  8. #define TUNA_B 2
  9. #define TUNA_C 4
  10. #define TUNA_D 8
  11.  
  12. void main(){
  13. int test1 = 3;
  14. int test2 = 7;
  15. int test3 = 8;
  16. int test4 = 12;
  17.  
  18. if(test3 & TUNA_A){
  19. printf("TUNA_A\n");
  20. }
  21.  
  22. if(test1 & TUNA_B){
  23. printf("TUNA_B\n");
  24. }
  25.  
  26. if(test1 & TUNA_C){
  27. printf("TUNA_C\n");
  28. }
  29.  
  30. if(test3 & TUNA_D){
  31. printf("test1 TUNA_D\n");
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement