Problem description:
What are the four types of integer variables in C language and what are their symbols?
Analysis:
Integer variable
Integer variables can be divided into the following categories:
1. basic type
The type specifier is int, which occupies 2 bytes in memory and its value is a basic integer constant.
2. Short integers
The type specifier is short int or short' c110f1. The range of bytes and values occupied is the same as that of the basic type.
3. Long integers
The type specifier is long int or long, occupying 4 bytes of memory, and its value is long integer constant.
4. Unsigned types
The type specifier is unsigned.
Unsigned types can match the above three types:
(1) The unsigned primitive type specifier is unsigned int or unsigned.
(2) The unsigned short integer type specifier is an unsigned short integer.
(3) The unsigned long integer specifier is an unsigned long integer.
Various unsigned types occupy the same number of bytes in memory space as the corresponding signed types. However, because the sign bit is omitted, it cannot represent a negative number. The following table lists the number of memory bytes allocated by various integer quantities in Turbo C and the representation range of this number.
Number of bytes allocated for the type descriptor range
int -32768~32767 ■■
Short integer -32768~32767 ■■
Signed int -32768~32767 ■■
Unsigned integer 0~65535 ■■
long int-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *~■■■■
Unsigned long integer 0 ~ * * * * * * * * * * * * *
Description of integer variables
The general forms of variable description are: type descriptor, variable name identifier, variable name identifier, ...; For example:
int a,b,c; (A, B and C are integer variables)
Long x, y; (x, y are long integer variables)
Unsigned p, q; (p, q are unsigned integer variables)