Possible Duplicate:
Integer summing blues, short += short problem
I have summarized my problem into following code snippet.I have two short vaiable and I am adding these two variable into another short variable,but I am getting compile time error.Why is it so?
1.short x = 1, y = 1;
2.short z = x + y;
Compile time error at line 2 EDIT:
If short+short=int
then why int+int !=long
By specification short + short -> int
. Do short z = (short)(x + y);
Best answer is given by Eric Lippert here: Integer summing blues, short += short problem
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