#include <iostream>
int main()
{
signed int a = 5;
unsigned char b = -5;
unsigned int c = a > b;
std::cout << c << std::endl;
}
This code prints 0
.
Can anyone please explain what is happening here? I am guessing that compiler converts a
and b
to same type(unsigend int
maybe) and compares them.