Stokes, Mark wrote:
When using sprintf with float variables, I get the following warning (and the
output
string gives a "(NULL)" in the place of the variable).
>
warning: passing arg 1 of `sprintf' from incompatible pointer type
see below
warning: double format, float arg (arg 3)
warning: double format, float arg (arg 3)
%f wants a float, not a double, you have to typecast the value or use %g
the main problem is that our printf doesn't yet support floats/doubles...
Example code:
void showfloat( )
{
float tempfloat;
char *buf[20];
thats certainly not what you want. you declare a pointer to an array
while you want an array...
char buf[20];
tempfloat = 9.40;
sprintf( buf, "%.0f", tempfloat );
usart1Puts( buf );
}
chris