There are some pretty big gaps in my programming knowledge, one of them being casts. I was writing code like this:
My compiler threw a warning, which I was kind of expecting. I switched it to:Code:int a, c; float b; a = 100; b = 0.8; c = a*b;
And that seemed to correct it, I just wanted to know if I'm using casts the right way. I got a little confused reading about the different kinds of casts. Also, should I actually put b=0.8f? Not sure since I already declared it as a float.Code:int a, c; float b; a = 100; b = 0.8; c = static_cast<int> (a*b);