Originally posted by mangpal singh:
As we know that short variable is implicitly casted to an int during computation, so does 4 bytes are allocated to it ? So if this is the case , there seems no use of short data type.
No, a short variable is allocated 2 bytes. It's just that when you are performing arithmetic, it is most likely copied into a register where it briefly is widened to 4 bytes.
What's the use? The main use, I imagine, is in arrays of shorts, perhaps an image's raster buffer decieds to store its data in that way. Thinking of an isolated short variable, it is harder to justify its use.