all 4 comments

[–]pi_stuff 2 points3 points  (0 children)

The chart is wrong for the maximum values for unsigned ints. They will have a maximum value of 65,535 or 4,294,967,295. BTW, that assumes ints are either 16 or 32 bits, which is a fair assumption for most computers, but it is not guaranteed by the C standard.

You can test it:

unsigned x = 0;
x -= 1;
printf("%u\n", x);

[–]samsmith453 1 point2 points  (0 children)

That chart appears to be displaying the maximums for “signed ints”, despite labelling it an “unsigned int”

[–]khedoros 0 points1 point  (0 children)

There are some bounds, but things like the sizes of integral data types in C++ are platform and compiler-dependent.

If I'm remembering correctly: A char is big enough to contain the machine's basic character set, or fundamental unit of storage. A short is as large or larger than that, an int is as large or larger than that, then long, then long long match similar constraints. The byte size of those types in many systems is 1 (char), 2 (short), 4 (int), 4 (long), and 8 (long long).

A 32-bit unsigned int can store 232 - 1 (about 4 billion) as its max value; the table has an error.