memcpy function

Hello,

I have the following sequence:
unsigned char buffer[4];
buffer[0] = 0x00;
buffer[1] = 0x00;
buffer[2] = 0x20;
buffer[3] = 0x41;

Then I copy memory to the value VAL with a float type:
float val = 0;
memcpy(&val, &buffer, sizeof(buffer));

And '10.0' is returned as a result.

Please, explain me why the result is 10.0?
Floating point numbers are stored a bit differently than integers since they have to support decimals. Look up floating point representation on google or wikipedia to find out exactly how they work.
Thank you a lot :-)
Topic archived. No new replies allowed.