[ create a new paste ] login | about

Link: http://codepad.org/NAjytkUw    [ raw code | output | fork ]

slevy1ster - C, pasted on Aug 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
int main() {


unsigned char c[] = {0x42, 0xe9, 0xcc, 0xcd};

union u_tag {
   char b[4];
   float fval;
} u;

u.b[0] = c[3];
u.b[1] = c[2];
u.b[2] = c[1];
u.b[3] = c[0];

printf("%f", u.fval);
return 0;
}


Output:
1
116.900002


Create a new paste based on this one


Comments: