C Programming :: Variables & Data Types - Discussion
Home > C Programming > Variables & Data Types > MCQs Questions Discussion
27 / 51
What will be output of the following "c" code?
#include
void main()
{
float f=5;
printf("%f",f<<2);
}
void main()
{
float f=5;
printf("%f",f<<2);
}
ACompilaiton Error: Cannot apply leftshift to float
B5
C10
D0
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
This particular code will produce an error, saying error: invalid operands to binary << (have 'float' and 'int').
The reason is that the Bit-wise operator(here <<), cannot be applied to float values.
Hence, correct option is A.
Read Full Answer
Report Error
Please Login First Click Here