Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Can a variable of type double be assigned to an integer variable?
Can a variable of type double be assigned to an integer variable?
Cannot assign to integer variable! Personality type is not good!

The principle of data type conversion is shown in the following figure:

Double floating

High ↑

long

Unsigned

Low int/char, short integer

"←" indicates certain conversion, such as float type is always converted to double type at runtime; "↑" indicates the conversion direction when operand types are different. For example, if the operation is a mixed operation of type int and type double, the type int will be converted to type double.