Converting float to char*

后端 未结 7 840
野性不改
野性不改 2021-02-04 01:54

How can I convert a float value to char* in C language?

7条回答
  •  情深已故
    2021-02-04 02:32

    typedef union{
        float a;
        char b[4];
    } my_union_t;
    

    You can access to float data value byte by byte and send it through 8-bit output buffer (e.g. USART) without casting.

提交回复
热议问题