How to convert Char* to float?

Hi everyone, I really need your help. As the post topic mention I'm trying to convert char* to float. Can anyone provide me some solution on this aspect? Thank you.

He said a char pointer :slight_smile:

One way to do it is with function atof

If it is a char, I assume it is a digit character, '0' - '9'. If so, you could use:

   char c = '5';
   float x;

   x = (float) (c - '0');

The ASCII code for the '5' digit is 53 and for '0' (i.e., zero) it is 48. Therefore:

'5' - '0'
53 - 48
5

which is then cast to a float.

He said char*, but what he presumably meant was an array of char. Not the same thing at all.

As the post topic mention I'm trying to convert char* to float.

On an eight bit Arduino, a "char*" is two bytes and a "float" is four.
Your question doesn't make a lot of sense.

If you're saying you've taken the address of a "float" and cast that address to a "char*" instead of the more natural "float*", then recovering the original "float" is trivial.