Float_Read(ptr) /*Value to be stored to EEPROM */ char xdata *ptr; { union /* UNION to access the bytes of int */ { float i; char split[4]; }data_trans; data_trans.split[0] = Read_EEPROM(ptr); data_trans.split[1] = Read_EEPROM(ptr+1); data_trans.split[2] = Read_EEPROM(ptr+2); data_trans.split[3] = Read_EEPROM(ptr+3); printf("Float in Function=%\n",data_trans.i); return (data_trans.i); } when the function return the float then its zero but the value of float in same function is right, Is it any problem with return statment?
Just as an aside, why did you choose 'i' as the name for the float? 'i' seems like a particularly poor choice for a floating-point value...
'i' seems like a particularly poor choice for a floating-point value... 'i' is a particularly poor choice for anything It amazes me that the very same people that erroneously claim C as "self documenting" are the users of 'i'. Erik
Assuming you wrote the value in the right order, you might want to check your printf statement.