What does the compiler do for my method regarding type conversion

Hey, I appreciate if you could tell me what the compiler does for my method. If I call it Area(10.1,10.1); he will return me 102 . So .01 cut? Do you have a good site where I can get information about this topic? Thanks for your time!

 float Area (float length, float width){ int result; result = length*width; return result; } 
0
source share
1 answer

Since you assign the value of the float expression to int, the data is simply truncated when assigned (but after evaluating the expression).

+5
source

All Articles