How does a conversion occur in C?
The data types for numerical operations used in C are integer, float. It is important to know how conversions occur between these two data types in numerical operations.
An example to understand the conversions of data types
x=y/2 + x/5;
This gives result as 3.1 , This is because:
y/2 gives 5/2 and an integer having arithmetic operation with integer gives integer as result as this gives 2 as result and not 2.5
x/5 gives 5.5/5 in this a float having arithmetic operation with float gives float as result sp this gives 1.1 as result, therefore x=2+1.1=3.1