Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In c language, int type and double type can be converted (addition, subtraction, multiplication and division) and can be run. Is there a mistake?
In c language, int type and double type can be converted (addition, subtraction, multiplication and division) and can be run. Is there a mistake?
Yes, there will be no mistake. The system will change all variables actually involved in the operation into double precision after calculation, as long as there is a floating point number or double precision expression, such as:

int I = 1;

float x=5,y;

y = x+I;

At runtime, the system will convert both X and I into double for calculation, and the final result will be saved as double type of Y. ..