0

I have a general question for situations where you need to change the type of a variable.

Let's say I have a float variable a but want it as an int, what I always did is

float a = 0.5;
int RoundedA = int(a);

However now I learned you should actually do it like:

float a = 0.5;
int RoundedA = (int)a;

The result of both is the same, so is it just a different style and it does the same, or is actually something different happening? And if so is there any performance difference between those two?

phuclv
  • 37,963
  • 15
  • 156
  • 475
D1du
  • 1

0 Answers0