- #include <stdio.h>
- #define checktheborders(x) \
- { \
- prev = -1; \
- x = 0; \
- \
- while (prev < x) \
- { \
- prev++; \
- x++; \
- } \
- printf("max value for " #x " is %lld\n", prev); \
- \
- prev = 1; \
- x = 0; \
- \
- while (prev > x) \
- { \
- prev--; \
- x--; \
- } \
- printf("min value for " #x " is %lld\n", prev); \
- }
- int main(void)
- {
- signed char signedchar = 0;
- unsigned char unsignedchar = 0;
- signed short int signedshortint = 0;
- unsigned short int unsignedshortint = 0;
- signed int signedint = 0;
- unsigned int unsignedint = 0;
- signed long int signedlongint = 0;
- unsigned long int unsignedlongint = 0;
- float floatvar = 0;
- double doublevar = 0;
- signed long long int prev = -1;
- checktheborders(signedchar);
- checktheborders(unsignedchar);
- checktheborders(signedshortint);
- checktheborders(unsignedshortint);
- checktheborders(signedint);
- checktheborders(unsignedint);
- checktheborders(signedlongint);
- checktheborders(unsignedlongint);
- checktheborders(floatvar);
- checktheborders(doublevar);
- return 0;
- }