C question : Why here i need to put parentheses | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C question : Why here i need to put parentheses

float​ ​index​ = ​0.0588​ * (​100​ * (​float​)y / (​float​)x) - ​0.296​ * (​100​ * (​float​)z / (​float​)x) - ​15.8​; Why i need to put parentheses around float

19th Jan 2022, 3:08 PM
Abdallah Ashraf
2 Answers
+ 2
y, x and z were converted to float. The use of parentheses are part of the conversion syntax. https://www.tutorialspoint.com/cprogramming/c_type_casting.htm
19th Jan 2022, 3:19 PM
Be Luchesse
Be Luchesse - avatar
19th Jan 2022, 3:32 PM
FanYu
FanYu - avatar