Signed integers can be used for positive, negative and zero, on the other hand, unsigned integers represents only non-negative numbers.
A signed int uses the most significant bit (the leftmost bit) to represent the sign of the number. If this bit is 0, the number is positive, and if it is 1, the number is negative.
What is output of the following code?
unsigned int a = 1;
int b = -1;
if (a > b)
{
std::cout << "a is greater than b";
}
else
{
std::cout << "b is greater than a";
}