chipKIT® Development Platform

Inspired by Arduino™

Difference between (float) and float(xxx)

Created Sat, 26 Jan 2013 02:25:51 +0000 by YOBE.


YOBE.

Sat, 26 Jan 2013 02:25:51 +0000

Hello, Could someone explain me what the difference is between:

int a=10; float b;

b=float(a); And b=(float)a;

Thanks


Jacob Christ

Sat, 26 Jan 2013 16:50:37 +0000

I think they result in the same values for b, but I like the latrer notation better or even:

b = (float)(a);

Typically parens just affect order of operation in these type of statements.

Jacob