0
Signed and unsigned integer
What's the point of modifying int to signed if it already contains both positive and negative values. And what're the advantages of modifying it to unsigned than, thus I can always take an absolute of any number?
1 Odpowiedź
+ 1
?? your not modifying the int, your just changing the potential max value the int can contain. If you declare an unsigned int, then the sign bit can be used to "hold" the number so a larger number can be assigned to it.
Paste the code below into your IDE.
#include <iostream>
#include <limits>
using namespace std;
int main()
{
cout << INT_MAX << endl;
cout << UINT_MAX << endl;
return 0;
}