Supposing we have following defination: char c = 10; int i = 20; I understand why c=c+i can't be compiled. But why c+=i can be compiled? Please help. Thanks
should be c=(char)(c+i); For expressions like opt1+=opt2; they can always interpreted as: opt1=(T)(opt1+opt2); where T is the type of opt1. This also applies to operators such as : -+, *=, /=, etc