Converting float to char*

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

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

7条回答
  •  梦如初夏
    2021-02-04 02:51

    In Arduino:

    //temporarily holds data from vals
    char charVal[10];                
    
    //4 is mininum width, 3 is precision; float value is copied onto buff
    dtostrf(123.234, 4, 3, charVal);
    
    monitor.print("charVal: ");
    monitor.println(charVal);
    

提交回复
热议问题