c - This code of mine is showing floating point error.. can anyone please exlain -


#include<stdio.h> void main() {    float = 5, b = 2;    int c;    c = % b;    printf("%d", c); } 

i getting floating point error n program-me..
please explain this..

the operands of operator % have integral (i.e. int, byte, ...). have cast floats first:

c = ((int)a) % ((int) b); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -