Integer and float conversion
If you would like to develop an effective C program. Then you should understand/know about some rules for implicit conversion of integer and real/floating value in C language.
Important rules are defined below:-
1. When we would perform an arithmetic operation between an integer and an integer operation will always produce an integer result.
For ex. 1- int + int = int;
5 + 4 = 9;
2. When we would perform an arithmetic operation between a real and a real operation will always produce a real result.
For ex. 2- real + real = real;
5.0 + 4.0 = 9.0;
3. When we would perform an operation between an integer and a real then this operation will always produce a real result.
For ex. 3- int + real = real;
5 + 4.0 = 9.0;
Process for example 3 - first integer will be promoted to a real constant/variable then this operation would be performed and result would be real.
RELATED TOPIC FROM C PROGRAMMING LANGUAGES :-