Varun Pratap Singh
Answered On : May 15th, 2012
In C language, int takes 2 bytes. Now 2 bytes mean 16 bits.
One bit out of these 16 bits is for sign (+ or -) of integer.
So, remaining 15 bits will store data in form of 0 and 1. The maximum value in binary number system using 15 bits can be 32768 (or 2^15).
So an integer can store value from -32768 to +32767.
And this becomes from 0 to 65536 for unsigned integers, due to the reason that total usable bits become 16.
Login to rate this answer.
[-32767,32767] is the minimum range for int, meaning a minimum size of 16 bits. Implementations may choose a wider size and range for integers.
That range covers most architectures, whether ones or twos complement.
Login to rate this answer.