In my assignment, it says
Do not add
long int
orlong long
private members to accomplish this as there is no guarantee that either can actually store larger numbers than anint
.
I know that int
has a maximum of 231-1 and long long
has a maximum of 263-1. Can someone give me an example to me why the given sentence is true?
It means exactly what it says. There's no guarantee that a long long
can store more numbers than an int
. It's at least as big, but it can be the same.
I know that int has a maximum of 2^31-1 and long long has a maximum of 2^63-1
This can be true for some platform, with some compiler, but it's not always the same. C++ doesn't guarantee either.
2) There are five standard signed integer types : “
signed char
”, “short int
”, “int
”, “long int
”, and “long long int
”. In this list, each type provides at least as much storage as those preceding it in the list. [...] (emphasis mine)