Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the maximum value of int in C language?
What is the maximum value of int in C language?
When unsigned 0 is stored in memory in binary, every bit is 0. Taking a 32-bit int as an example, the binary of (unsigned int)0 is:

00000000000000000000000000000000

After bit-by-bit inversion (~), it becomes:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 / kloc-0/ 1 1 1 16543 8+0 1 1 1 1 1 1 1 1 1 1

The decimal system at this time is:

4294967295

Divided by 2 (because half of the int types represent negative numbers, one more than positive numbers), it is:

2 147483647

Is the maximum value of type 32-bit int.

The largest integer data type in C language is long, accounting for 4 bytes.

Both short integer and integer in C account for 2 bytes, and the range of values is -32768 ~ ~ 32767.

Long integers account for 4 bytes, and the range of values is-2147483648 ~ ~ 2147483647.

If it is an unsigned number, the data that can be represented is

Short integer and integer:? 0 - 65535

Long integer: 0-4294967295

In C language, if a large number exceeds the maximum length integer, it can be stored by double, which will not affect the operation accuracy.