char ch = 'C';
The literal 'C'
is of type int and demoted to type char (conversion to the left operator during assignment).
float fl = 2.2;
The literal 2.2
is of type double and demoted to type float (conversion to the left operator during assignment).
ch = ch + 1;
The variable ch is of type char and promoted to type int (integer promotions).
The result of the addition ch + 1
is of type int and demoted to type char (conversion to the left operator during assignment).
i = fl + 2 * ch;
The variable ch is of type char and promoted to type int (integer promotions).
The result of 2 * ch
is of type int and promoted to type float (balancing).
The result of fl + 2 * ch
is of type float. The float is demoted to an int (conversion to the left operator during assignment). This is a dangerous conversion because of loss of precision and a good compiler should give a warning for attempting to store a float inside an int without an explicit cast.
fl = 2.0 * ch + i;
The variable ch is of type char and first promoted to type int (integer promotions) and then promoted to type double (balancing).
The result of 2.0 * ch
is of type double.
The result of 2.0 * ch + i
is of type double and demoted to type float (conversion to the left operator during assignment).
ch = 5212205.17;
The literal 5212205.17 is of type double and demoted to type char (conversion to the left operator during assignment). This is a dangerous conversion and possibly also undefined behavior, since the signedness of char is implementation-defined, and also the number cannot fit inside a char.
Attempting to store a signed floating point number inside a type that cannot represent it (such as an unsigned int) is undefined behavior, i.e. a severe bug.