C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - Point Out Correct Statements (Q.No. 2)
2.
Which of the following operations are INCORRECT?
int i = 35; i = i%5;
short int j = 255; j = j;
long int k = 365L; k = k;
float a = 3.14; a = a%3;
Answer: Option
Explanation:

float a = 3.14; a = a%3; gives "Illegal use of floating point" error.

The modulus (%) operator can only be used on integer types. We have to use fmod() function in math.h for float values.

Discussion:
17 comments Page 2 of 2.

Veni said:   6 years ago
I can't understand this, Can anyone explain clearly?

Mitali said:   1 decade ago
Why in option B & C variables are redefined?

Raut Achyut said:   7 years ago
How to initialize 365L in K variable?

Siddharth Jagani said:   1 decade ago
What if we don't put L in k= 365L?

Garry said:   1 decade ago
L stands for long data type,

Harry said:   1 decade ago
What is the work of %?

Durga said:   1 decade ago
Over flow means?


Post your comments here:

Your comments will be displayed after verification.