This cannot be done completely in a C-compatible way, but you can use unions:
union{
int i;
float f;
} u;
u.f = 123.456;
Today, this should work on almost all systems. And, of course, it is assumed that floatthey inthave the same size.
, , , undefined.
(, - . ) memcpy():
int i;
float f;
f = 123.456;
memcpy(&i, &f, sizeof(int));