Which one of the following is NOT a default promotion?

1) If either operand of an arithmetic operator is unsigned long, the other operand is promoted to unsigned long.
2) If either operand of an arithmetic operator is unsigned int, the other operand is promoted to unsigned int.
3) If either operand of an arithmetic operator is int, the other operand is promoted to int.
4) If either operand of an arithmetic operator is double, the other operand is promoted to double.
5) If either operand of an arithmetic operator is short, the other operand is promoted to short.

Showing Answers 1 - 1 of 1 Answers

Here we cant say the default promotion without knowing the other operand.But if two operands are of different datatypes and the arithmetic operation is performed on these operands the compiler allocates the memory  of higher datatype for the resulting value.
For eg :   see the following code

int a=10,b=4;                                  
flaot c;
c=a/b;
result: c=2.0000000

int / long int=long int
double/long double=long double
float/double=double

Therefore we can say that preference is for   higher datatype.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions