Type Transformation Learning Record

short a = 1;short b =2;short c = a+b compilation error.
Reason:
The type of the expression will be automatically upgraded during the a+b operation, that is, the int type. When the result is assigned to the short type c, the type will not match. If you do not force the conversion to short, an error will be reported.

Guess you like

Origin blog.csdn.net/qq_42540393/article/details/115802925