Short Data Type In C++

Short Data Type ?

Short data type is an 8-bit signed two's complement integer.


Byte data type :

The minimum value is -32,768 and maximum value is 32,767(inclusive).

Short data type can be used to save memory .

A short is 2 times smaller than an int.

Example:

 short s= 100, short r=-200

Example 1:



Output :

    char   1
    bool   1
    short  2
    int    4
    long   4
    float  4
    double 8
    Press any key to continue . . .

Example 2:

Output :

    In Function f
    localX is 1
    In Function f
    localX is 1
    Press any key to continue . . .

Example 3:

Output :

    aimtocode.com