RicardasSim

C alternative tokens

Nov 10th, 2018
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. //-std=c99
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <iso646.h>
  6.  
  7. /*
  8. https://en.wikipedia.org/wiki/C_alternative_tokens
  9.  
  10. macro   defined as
  11. -------------------
  12. and     &&
  13. and_eq  &=
  14. bitand  &
  15. bitor   |
  16. compl   ~
  17. not     !
  18. not_eq  !=
  19. or      ||
  20. or_eq   |=
  21. xor     ^
  22. xor_eq  ^=
  23. */
  24.  
  25. int main (int argc, char **argv)
  26. {
  27.  
  28. int a = 0;
  29. int b = 1;
  30.  
  31. if(a==0 and b==2) printf("1: true\n");
  32. else printf("1: false\n");
  33.  
  34. if(a==0 or b==2) printf("2: true\n");
  35. else printf("2: false\n");
  36.  
  37. if(not a) printf("3: true\n");
  38. else printf("3: false\n");
  39.  
  40. return 0;
  41. }
  42.  
  43. /*
  44. output:
  45.  
  46. 1: false
  47. 2: true
  48. 3: true
  49.  
  50. */
Advertisement
Add Comment
Please, Sign In to add comment