Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 3 months ago.
how to convert double value to uint8_t value.
I'm new to mbed and its developing. I have a double value . That value i want to convert to uint8_t type array how do i do it.
My value -> double test=123.234 I want to convert to -> uint8_t convert[]={'1','2','3','.','2','3','4'};
And help is appreciated. Thank you
1 Answer
8 years, 3 months ago.
I assume you are converting double to ascii string??? If so, be careful with your size of convert[] as it must be large enough to take any values of test. For your example, a size of 8 works
uint_8 convert[8]; double test = 123.456; sprintf(convert, "%7.3f", test);