main()
{
float f=5,g=10;
enum{i=10,j=20,k=50};
printf("%d\n",++k);
printf("%f\n",f<<2);
printf("%lf\n",f%g);
printf("%lf\n",fmod(f,g));
}
Answer:
Line no 5: Error: Lvalue
required
Line no 6: Cannot apply
leftshift to float
Line no 7: Cannot apply mod
to float
Explanation:
Enumeration
constants cannot be modified, so you cannot apply ++.
Bit-wise
operators and % operators cannot be applied on float values.
fmod()
is to find the modulus values for floats as % operator is for ints.
Blog Author: Vijay Kumar
Go to: Java Aptitude, C C++ Aptitude