Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the difference between signed integer and signed short integer in C language?
What is the difference between signed integer and signed short integer in C language?
Signed integer, written as signed int, abbreviated as int has the same effect, because the default of C language is signed number.

Signed short integer, written as signed short, abbreviated as short.

Under the 16-bit compiler, both int and short occupy 2 bytes, ranging from-32768 to+32767. There is no difference between the two at this time.

There are differences between 32-bit and 64-bit compilers:

1 takes up different space. Sizeof(int) = 4, sizeof(short) = 2. That is, short is still 2 bytes, and int becomes 4 bytes.

2 can indicate different ranges.

Due to different spaces, the range of short is still -32768~+32767, while the range of int is expanded to-2147483648 ~+2147483647.