Arithmetic operator of return type

int main(int argc, char **argv) { unsigned char a = 10, b = 100; std::cout<<sizeof(ab)<<endl; return 1; } 

Output: 4

What is the return data type?

+6
source share
1 answer

Arithmetic is always performed, at least with int precision in C ++. a and b rise to int , and the result of the subtraction is of type int .

There is a set of rules used to determine the type used for an arithmetic operation; MSDN has a handy table listing the rules .

+8
source

Source: https://habr.com/ru/post/887534/


All Articles