This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Union float return

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?

Parents Reply Children
No data