C++ data type ranges

can someone tell me if i made a mistake. i also apologise for it being a bit messy, but i couldn't put this into a table. to try make things easier to read, i bolded each colmn.

Type Size (bytes) Range-Minimum Range- Maximum

Character 1 -128 127
Unsigned Char 1 0 255
Signed Char 1 -128 127
Integer 4 -2,147,483,648 2,147,483,647
Signed Int 4 0 4,294,967,295
Unsigned Int 4 -2,147,483,648 2,147,483,647
Short Int 2 -32,768 32,767
Signed short Int 2 0 65,535
Unsigned Short Int 2 -32,768 32,767
Long Int 4 -2,147,483,648 2,147,483,647
Signed Long Int 8 0 4,294,967,295
Unsigned Long Int 8 -2,147,483,648 2,147,483,647
Float 4 1.8E-38 3.4E+38
Double 8 2.2E-308 1.8E+308
Long Double 8 2.2E-308 1.8E+308
Bool 1 True/False True/False
Wchar_t 2 or 4 0 65,535
Take a look here: http://msdn.microsoft.com/en-us/library/s3f49ktz(v=vs.80).aspx
There's no real need to memorize these though, I don't really see the point in this as long as you have a general idea of what the are.
closed account (yUq2Nwbp)
i agree with you ascii..........especially when their sizes depend on system....it is certain size only for char....it takes 1 byte..
std::numeric_limits<T>::max() and std::numeric_limits<T>::min() will give you all of these values, BTW.

And as david91 sort of said, C++ gives you only the following guarantees:

sizeof(char) == 1 (byte) [-128...127]
sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)


(note that long long is a GCC extension that has wended its way into C++0x standard).

Topic archived. No new replies allowed.