error when create function

i wrote a function that return an array char but it doesn't active. please help me!!! thank

[          char[] printValue(float x)
            char format[]="%d.%d";
            int prefix=int(x);
            int suffix=(x-prefix)*100;
            char ret[7];
            return ret;


You return a local variable that is on the stack and wiped probably by other stuff - read about variable scope. Best would be for the caller of your function to give a memory space to use, see dtostr() as an example

If you want to print a float f with 2 digits after the decimal dot you can just do Serial.print(f) as 2 digits is the default. If you want 5 you do Serial.print(f,5)