Why does C++ prints unsigned char value as negative?
问题 I'm trying to understand the implicit conversion rules in C++ and I understood that when there are one operation between two primary types the "lower type" is promoted to the "higher type", so let say for: int a = 5; float b = 0.5; std::cout << a + b << "\n"; should print 5.5 because 'a' gets promoted to float type. I also understood that unsigned types are "higher types" than the signed counter parts so: int c = 5; unsigned int d = 10; std::cout << c - d << "\n"; prints 4294967291 because 'c