RicardasSim

double evaluation

Jun 8th, 2019
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define MINVAL(A,B)( A<B ? A : B )
  5. #define MAXVAL(A,B)( A>B ? A : B )
  6.  
  7. int main (int argc, char **argv){
  8.  
  9. int a = 1;
  10. int b = 2;
  11.  
  12. printf("%d\n",MINVAL(a,b));
  13. printf("%d\n",MAXVAL(a,b));
  14.  
  15. //int result = a++ < b++ ? a++ : b++;
  16. //int result = a++ > b++ ? a++ : b++;
  17.  
  18. printf("%d\n",MINVAL(a++,b++));
  19. printf("%d\n",MAXVAL(a++,b++));
  20.  
  21. return 0;
  22. }
  23.  
  24. /*
  25. output:
  26.  
  27. 1
  28. 2
  29. 2
  30. 4
  31.  
  32. */
Advertisement
Add Comment
Please, Sign In to add comment