Log in

View Full Version : Suspicious pointer conversion


ebowla
26-01-2008, 11:27
Ive tried looking the answer up in several places and I can't seem to solve it.

unsigned int analog=(unsigned int)Get_Analog_Value(rc_ana_in01);
printf(analog);

I get an error pointing to the printf statement saying suspicious pointer conversion. The analog imput is a potentiometer. As far as I know everything is wired correctly, the code even compiles and runs, but the printf isnt displaying.

PROBLEM SOLVED CLOSE THREAD/NO MORE POSTS

JonathanLKS
26-01-2008, 11:43
printf doesn't work that way
You need to have a string, even if your just printing a single int
so you'll need to write it like this

printf("%d\r\n", analog); //\r\n for newline

ebowla
26-01-2008, 12:13
thanks, yea I figured it out on my own with the help of a mentor(who JUST showed up) I apprieciate the help.

PROBLEM SOLVED, CLOSE THREAD/NO MORE POSTS