concatenate an array to one float variable

Hi,

I'm trying to join an array of chars into a variable. I'm reading in ASCII chars from a processing sketch.

Example:

char inData[4]={1,2,3,'.',4,5}; //Read in by serial as ASCII

want to try make variable float x equal to:

float x = 123.45

I would appreciate any direction, Thanks.

This should do it.

float x = atof(inData);

Well, considering that inData is big enough to handle the whole string. You might want to increase the size of the inData array.

SurferTim:
Well, considering that inData is big enough to handle the whole string. You might want to increase the size of the inData array.

In addition to adding the null terminator, those numbers need to be characters:

char inData[4]={'1', '2', '3', '.', '4', '5', '\0'};