DIGIT-ARC read-only archive · snapshot: July 23, 2026

How To Calculate Range of Data Types in C

3 posts · originally from https://geek.digit.in/community/threads/how-to-calculate-range-of-data-types-in-c.77687/

krishnandu.sarkar
krishnandu.sarkar Original post #1
Jan 8, 2008 at 11:39 AM
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?????...................
T
Jan 8, 2008 at 5:56 PM
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 at 7:01 PM
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.