As discussed in the book, each data type has a finite size. There is a the minimum range of values each data type supports as required by the C standard. However, the compiler implementations may vary and hence, may have a larger range actually supported.

C provides the programmers with pre-defined macros to find out the range of built-in datatypes. These macros are defined in system header file “limits.h“. Following macros define the minimum and maximum values of built-in datatypes:

CHAR_MIN       // Minimum value for a char.
CHAR_MAX      // Maximum value for a char.
UCHAR_MAX   // Maximum value for an unsigned char.
SHRT_MIN       // Minimum value for a short int.
SHRT_MAX      // Maximum value for a short int.
USHRT_MAX   // Maximum value for an unsigned short int.
INT_MIN           // Minimum value for an int.
INT_MAX          // Maximum value for an int.
UINT_MAX       // Maximum value for an unsigned int.
LONG_MIN      // Minimum value for a long int.
LONG_MAX     // Maximum value for a long int.
ULONG_MAX  // Maximum value for an unsigned long int.

Note that the minimum value for all unsigned datatypes is ZERO. We can print any of the above macros in a C-program to know the values. e.g. we can print min and max value of INT using following printf statement:

printf(“Min and Max value for signed int is %d and %d\n”, INT_MIN, INT_MAX);

The output of the above printf statement on our system is:

Min and Max value for signed int is -2147483648 and 2147483647

NOTE: Do not forget to include header file <limits.h> for the program to find the values for the above mentioned macros.