# How To Calculate Range of Data Types in C



## krishnandu.sarkar (Jan 8, 2008)

Hiiiiiiiiiiiiiii.............Can any1 tell me d process to calculate range of data types in c????

I mean INT allocates 2 bytes in memory...........n itz range in 16 bit compilor is frm -37628 to +37627.............now how these is calculated?????...................


----------



## ThinkFree (Jan 8, 2008)

Its -32768 to +32767
2 raised to power 16(16 bit sys)=65536, so it can have 65536 different integer values (32768+32767+1 for 0 =65536). Similarly for 32 bit, 2 raised to power 32 values can be there for integers


----------



## blueshift (Jan 8, 2008)

The range values are defined in *limits.h* header file.
For displaying the range of INT data type, you can print the value of INT_MAX and INT_MIN macros defined in that header file.


----------

