Many sources, including Microsoft, reference both the int and long type as being 4 bytes and having a range of (signed) -2,147,483,648 to 2,147,483,647. What is the point of having a long primitive type if it doesn’t actually provide a larger range of values?
Many sources, including Microsoft , reference both the int and long type as being
Share
The only things guaranteed about integer types are:
sizeof(char) == 1sizeof(char) <= sizeof(short)sizeof(short) <= sizeof(int)sizeof(int) <= sizeof(long)sizeof(long) <= sizeof(long long)sizeof(char) * CHAR_BIT >= 8sizeof(short) * CHAR_BIT >= 16sizeof(int) * CHAR_BIT >= 16sizeof(long) * CHAR_BIT >= 32sizeof(long long) * CHAR_BIT >= 64The other things are implementation defined. Thanks to (4), both
longandintcan have the same size, but it must be at least 32 bits (thanks to (9)).