Current location - Loan Platform Complete Network - Big data management - How many digits does int have at most?
How many digits does int have at most?
The maximum length of int is 1 1 bit. On a 32-bit machine, the range of int is-231~ 231-1; ? That is:; The range of integer variable int is related to the word length of a computer, and the length of int is a computer word length.

The number of bytes allowed to be stored in the int type is 4 bytes. The minimum value that can be stored in the converted int unsigned type is 0, and the maximum value is 4294967295 (i.e. 4B=32b, and the maximum value is 32 1).

Extended data:

Int word length problem:

Long int should be at least as long as int, and int should be at least as long as short int.

1 and C/C++ stipulate that the length of int is the same as that of machine;

2. The word length of the operating system and the word length of the machine may be inconsistent;

3. The compiler defines the word length of int according to the word length of the operating system;

On some embedded computer systems without operating system, the length of int is consistent with the word length of processor; When there is an operating system, the word length of the operating system is not necessarily the same as that of the processor. At this time, the compiler defines the word length of int according to the word length of the operating system: "For example, run DOS 16 system on a 64-bit computer.

Then int in all C/C++ compilers of dos 16 is 16 bit; If you run win32 system on a 64-bit computer, all C/C++ compilers of win32 are 32-bit. . (The word length of CPU refers to the maximum width of data that can be processed by an instruction/operation.

For the range of integer values, each compiler has a standard header file: the header file limits.h defines some macros, which represent the range of all data types used by the compiler, so it is enough to use these macros when programming.