difference between int and short int

Aug 19, 2014 at 2:46pm

size of int is 2 bytes and of short int is also 2 bytes.The range of values for int and short int are the same.

Then why int and short int are used?
only int or short int is enough

Please clarify my doubts.......
Aug 19, 2014 at 3:15pm
The size of int depends on the data model being used. The size of short is always guaranteed to be 2 bytes, but the size of int is implementation specific. You would think that this would cause a lot of issues with code between systems, but it's easy enough to avoid using int all together making this a non-issue.
Aug 19, 2014 at 3:15pm
Size of int and short are implementation defined.

int and short are 2 bytes on 16 compilers.
One 32 bit compilers, int is 4 bytes, while short remains 16 bits.
Aug 19, 2014 at 3:39pm
@AbstractionAnon and @Computergeek01,

what is meant by implementation defined?

Will you please explain it clearly?
Aug 19, 2014 at 3:43pm
Implementation defined means it depends on the compiler.
Topic archived. No new replies allowed.