1. #include <stdio.h>
  2. #define checktheborders(x) \
  3. { \
  4. prev = -1; \
  5. x = 0; \
  6. \
  7. while (prev < x) \
  8. { \
  9. prev++; \
  10. x++; \
  11. } \
  12. printf("max value for " #x " is %lld\n", prev); \
  13. \
  14. prev = 1; \
  15. x = 0; \
  16. \
  17. while (prev > x) \
  18. { \
  19. prev--; \
  20. x--; \
  21. } \
  22. printf("min value for " #x " is %lld\n", prev); \
  23. }
  24. int main(void)
  25. {
  26. signed char signedchar = 0;
  27. unsigned char unsignedchar = 0;
  28. signed short int signedshortint = 0;
  29. unsigned short int unsignedshortint = 0;
  30. signed int signedint = 0;
  31. unsigned int unsignedint = 0;
  32. signed long int signedlongint = 0;
  33. unsigned long int unsignedlongint = 0;
  34. float floatvar = 0;
  35. double doublevar = 0;
  36. signed long long int prev = -1;
  37. checktheborders(signedchar);
  38. checktheborders(unsignedchar);
  39. checktheborders(signedshortint);
  40. checktheborders(unsignedshortint);
  41. checktheborders(signedint);
  42. checktheborders(unsignedint);
  43. checktheborders(signedlongint);
  44. checktheborders(unsignedlongint);
  45. checktheborders(floatvar);
  46. checktheborders(doublevar);
  47. return 0;
  48. }