Program to find range of different data types in C

ranges of various data types

Data type ranges specifies maximum value and minimum value which can be stored inside a variable of given data type. These data types can be used only when header files are included in program.

Below are the symbolic constants defined in header file which returns max and min limit for specific type of data.

Constants, data types predefined in   header file:

    • INT_MIN: This constant return min value of type integer (-32768)
    • INT_MAX: This constant return max value of type integer (32767)
    • UINT_MAX: This constant return max value of type unsigned integer (65535)
    • SHRT_MIN: This constant return min value of type short (-32768)
    • SHRT_MAX: This constant return max value of type short (32767)
    • USHRT_MAX: This constant return max value of unsigned short (65535)
    • LONG_MIN: This constant return min value of type long (-2147483648)
    • LONG_MAX: This constant return max value of type long (2147483647)
    • ULONG_MAX: This constant return max value of type long (4294967295)
    • CHAR_MIN: This constant return min value of type char regardless of whether type is signed or unsigned by default (-128)
    • CHAR_MAX: This constant return max value of type char regardless of whether type is signed or unsigned by default (127)
    • SCHAR_MIN: This constant return min value of type char (-128)
    • SCHAR_MAX: This constant return max value of type char (127)
    • UCHAR_MAX: This constant return max value of unsigned char (255)

Program to find range of int, char, short int, long int, etc types

program

Output:

output

Explanation:

Output of program shows minimum and maximum value held by any data type. It includes range of int, short int, long int, char, unsigned char types etc.

1 thought on “Program to find range of different data types in C”

Leave a Reply

error: Content is protected !!
%d bloggers like this: