sprintf pointer functions as character array arguments

In the sketch below I get the value from getValueTwo() as output for both sprintf values. If I reverse the calls in sprintf then I get the value of GetValueOne() for both values.

The only thing I have found to get the expected result from sprintf was to make sure the return values from the stub functions are a different lengths - be them statically declared or initialized with a string they have to be different length.

Any suggestions to fixing the issue or a better way to create a comma delimited list of values in a character array to be used as HTTP POST data are welcome.

void setup() { Serial.begin(9600); Serial.println("Starting"); }

void loop()
{
char logEntry[80];
sprintf(logEntry,"%s,%s\n",getValueOne(),getValueTwo());
Serial.print(logEntry);
}

char *getValueOne()
{
char retval=“12.01”;
return retval;
}

char *getValueTwo()
{
char retval=“70.20”;
return retval;
}

Don't return pointers to automatic variables and expect sensible results.

Do use code tags.

(Uncompiled, untested)

char retval1[]="12.01";
char retval2[]="70.20";

void setup() {
  Serial.begin(9600);
  Serial.println("Starting");
}

void loop()
{
  char logEntry[80];
  sprintf(logEntry,"%s,%s\n",getValueOne(),getValueTwo());
  Serial.print(logEntry);
}

char *getValueOne()
{
  return retval1;
}

char *getValueTwo()
{

  return retval2;
}