int has 16bits that is 2 bytes but short int has 8 bits that is 1 byte
Login to rate this answer.
hi i hope this will be useful for u.
in 16 bit processor (Ex: 8086), int data type contains 2 bytes(16 bits) and short contains 1 bytes(8 bits).
in 32 bit processor (80486), int data type contains 4 bytes(32 bits) and short contains 2 bytes(16 bits).
thanks
kannan R
Login to rate this answer.
sumit
Answered On : Feb 5th, 2012
Sorry to say that actually in most of C compiler short int is also of 16 bit and they are equivalent to each other.
Login to rate this answer.
The general idea is that short "always" represents a 16-bit integer, whereas int represents whatever the native word size is for that particular architecture (16- or 32-bit). "Always" is in scare quotes for those oddball architectures that use weird word sizes. All you can really be guaranteed of is that sizeof (char) <= sizeof (short) <= sizeof (int) <= sizeof (long).
Per the C standard, both int and short must represent *at least* the range [-32767,32767] and the unsigned versions must represent *at least* the range [0,65535], so both must be *at least* 16 bits wide.
Login to rate this answer.