If hi have , in C, follow expression a+b
, where
signed long a;
unsigned short b;
..... wich is type of result?
I think that is unsigned long for usual conversion... But maybe not... For a machine with integer on 16 bit, short and long can have also 16 bit... So...
- For promotion integer
b
is promoted to unsigned int ... And now I havesigned long + unsigned int
.. Not same type... - For usual conversion ... we convert signed long and unsigned int in unsigned long (tupe unsigned with rank of signed type)...
So if a = -10
and b = 120
, a + b != 0
... In this case a + b = (65426)_10
this is right?