priority vs severity
Priority vs Severity
March 14, 2023
Start with always/never
Start with always/never
March 28, 2023

March 21, 2023

Unsigned Integer

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";
}

Unsigned Integer
This website uses cookies to improve your experience. By using this website you agree to our Data Privacy Statement
Read more