One: A hodgepodge of numerical types
(1) The short, int, and long types all represent integer values. The size of the storage space is different
In general, the short type is half the machine word length, the int type is a machine word length, and the long type is one or two machines
The word length (in 32-bit machines, the int type and the long type are usually the same word lengths).
(2) Definition of constants and scope of representation:
unsigned int 0~4294967295 is 2^32-1
int-2147483648~2147483647 is 2^ (-31) ~ 2^31-1
unsigned long 0~4294967295 is 2^32-1
long-2147483648~2147483647 is 2^ (-31) ~ 2^31-1
The maximum value of long long: 9223372036854775807 is 2^63-1
The minimum value of long long:-9223372036854775808 is 2^ (-63)
Unsigned the maximum value of a long long: 18446744073709551615 is 2^64-1
__int64 Maximum: 9223372036854775807 is 2^63-1.
Minimum value of __int64:9223372036854775808 is 2^ (-63)
Maximum value of unsigned __int64:18446744073709551615 is 2^64-1
(3) The number of bytes for C and C + + types
32-bit compilers
Char:1 bytes
char* (i.e. pointer variable): 4 bytes (32-bit addressing space is 2^32, which is 32 bit, or 4 bytes. Similarly 64-bit compiler) int * is also 4 bytes
Short Int:2 bytes
Int:4 bytes
Unsigned int:4 bytes
Float:4 bytes
Double:8 bytes
Long:4 bytes
A long long:8 bytes
Unsigned long:4 bytes
64-bit compilers
Char:1 bytes
char* (i.e. pointer variable): 8 bytes int * is also 8 bytes
Short Int:2 bytes
Int:4 bytes
Unsigned int:4 bytes
Float:4 bytes
Double:8 bytes
Long:8 bytes (32-bit and 64-bit become long, others have not changed AH)
A long long:8 bytes
Unsigned long:8 bytes
Two:-----u/u and l/l of constant constants and some explanations of ul/ul
(1) Conditions of Use
1. The numerical constants are: Integer constants, floating-point constants;
2. Only numeric constants have suffix descriptions;
3. Numeric constant suffixes do not distinguish between uppercase and lowercase letters.
(2) The representation of integer constants is:
Decimal form, octal form starting with 0, 16-in form starting with 0x, no binary form. The integer constant is signed int by default.
The suffix of type conversion for integer constants is only a combination of U or u (unsigned), L or L (long), u/u and l/l (e.g. UL, Lu, Lu, etc.). Example: 100u; -123u; 0x123l;
(3) The representation of floating-point constants is:
Scientific counting form and decimal form. Floating-point constants are double by default.
The suffix for type conversion of a floating-point constant is only: F or f (single-precision floating-point number), L or L (long double-precision floating-point number).
(Note: Because floating-point constants are always signed, there is no u or u afterprefix). Example: 1.23e5f; 1.23l; -123.45f;
(4) The type of an integer constant is the first type in the following table that can represent its value:
decimal integer constant with no suffix: int,long int,long long int
Decimal integer constant with the letter U or u as suffix: unsigned int,unsigned long int,unsigned long Long int
Decimal integer constant with the letter L or L as suffix: long int,long long int
Decimal integer constant with the letter U or U and letter L or L as suffix: unsigned long int. unsigned long long int
Decimal integer constant with the letter ll or ll suffix: long long int
Decimal integer constant with the letter U or U and letter ll or ll as suffix: unsigned long long int
octal or hexadecimal constant with no suffix: Int. Unsigned int,long int,unsigned long Int,long long int,unsigned long Long int
octal or hexadecimal constants with the letter U or u as suffix: unsigned int,unsigned long int,unsigned long Long int
octal or hexadecimal constant with the letter L or L as a suffix: long int. unsigned long int. Long long int,unsigned Long long int
octal or hexadecimal constants with the letters U or U and the letter L or L as suffixes at the same time: unsigned long int,unsigned long long int
octal or hexadecimal constants with the letters ll or LL as suffixes: long long int. unsigned long long int
The same time with the letter U or U and the letter ll or ll as the suffix of the octal or hexadecimal constants: unsigned long long int
The byte and representation range of the C + + type