int main(int argc, char **argv)
{
unsigned char a = 10, b = 100;
std::cout<<sizeof(a-b)<<endl;
return 1;
}
Output: 4
What is the return data type?
Arithmetic is always performed at least with int
precision in C++. a
and b
are both promoted to int
and the result of the subtraction is of type int
.
There are a set of rules used to determine the type used for an arithmetic operation; MSDN has a handy table listing the rules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With