So I have this code
char [] a = {'a','b','c'};
char c = 'a' + 'b'; //works
char c2 = 98 + 97; //works
char c3 = a[0] + a[1]; //compile time error
So all of them are the same functionality but upon getting and using an array value it is giving me a compile time error. What is the cause of this??
The result of the additive operator applied two char operands is an int.
then why can I do this?
char c2 = (int)((int)98 + (int)97);