- #1
spursfan2110
- 21
- 0
D. When evaluating a mixed type expression (e.g. a + b) if either operand is a floating type,
which of the following conversions or promotions may occur
i. int is converted to float
ii. float is promoted to double
iii. double is promoted to long double
iv. int is promoted to unsigned int
v. None of the above
Just wanted to double check here and confirm my answer. I know that int will be converted to float, so (i) is correct, (ii and iii) could take place if the non floating type integer is a double or long double, I don't see a reason for an int to be converted, it will simply go to float, disproving (iv), and (v) is not right. Do you guys agree? Thanks!
which of the following conversions or promotions may occur
i. int is converted to float
ii. float is promoted to double
iii. double is promoted to long double
iv. int is promoted to unsigned int
v. None of the above
Just wanted to double check here and confirm my answer. I know that int will be converted to float, so (i) is correct, (ii and iii) could take place if the non floating type integer is a double or long double, I don't see a reason for an int to be converted, it will simply go to float, disproving (iv), and (v) is not right. Do you guys agree? Thanks!