difference between int and short int


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.......
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.
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.
@AbstractionAnon and @Computergeek01,

what is meant by implementation defined?

Will you please explain it clearly?
Implementation defined means it depends on the compiler.
Topic archived. No new replies allowed.