Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the range of integer values in "c++"?
What is the range of integer values in "c++"?
In C/C++, integer data is defined by int, and the range of integers refers to the range of integers that can be expressed by int type.

In a 32-bit or 64-bit machine, int occupies 4 bytes, which is 32 bits.

The largest positive integer that int can represent is: 0111111165438. 0111111111.

The smallest negative integer that an int can represent is: 1 0000000000000 (the highest bit indicates the sign bit, and the negative bit is1). Negative numbers exist in the form of complement in computers, so the corresponding original code (the complement of complement) is also 1000000000.

Therefore, the value range of the final int type (integer) is-231~ 231-1.