saving . . . saved type casting has been deleted. type casting has been hidden .
type casting
Title
Question
In assignment question, 
i can understand typecasting of given expression but what is the meaning of real division in type casting?


C-and-Cpp Increment-And-Decrement-Operators 11-12 min 50-60 sec 29-02-20, 12:23 p.m. prabhu84a

Answers:

When you divide say 5 by 4, the result depends on whether you are talking about integer division of real division.  In integer division, the answer is 1 (quotient).  In real division, the answer is 1.25.
29-02-20, 2:57 p.m. bhaskar76


If you are expecting a floating point value as your answer, either the numerator or denominator should be float. If both are integer, the result will be in integer. The fractional part will be truncated. 
eg. 5/2=2
and 5/2.0=2.5 or 5.0/2=2.5 (example for implicit type casting - if one of the number is float, the answer will be in float)

(float)5/2=2.5(example for explicit type conversion)
29-02-20, 4:18 p.m. gsivakamasundari


Log-in to answer to this question.