c - warning: illegal conversion of pointer to integer with char and structure to string -



c - warning: illegal conversion of pointer to integer with char and structure to string -

i have annoying problem...

i have able display text construction onto lcd display micro controller.

these affected areas:

struct menu_id { char id; char menu[11]; char submenu; }; void main (void){ struct menu_id mainmenu[5] = { {0, "chnl1", 1}, {0, "chnl2", 2}, {0, "mal codes", 3}, {1, "chnl1...", 0}, {2, "chnl2...", 0}, }; print(mainmenu[0].id, mainmenu[0].menu); } void print (char line1, char line2) { char temp[11]; lcd_register_com(); //set command register outputchar(lcd_line0); //line 0,0 lcd_register_data(); //set info register sprintf(temp, "%c", line1); outputstring(temp); lcd_register_com(); //set command register outputchar(lcd_line1); //line 1,0 lcd_register_data(); //set info register sprintf(temp, "%c", line2); outputstring(temp); }

everytime seek build code throws error main_test.c:108: warning: illegal conversion of pointer integer when phone call print function, "print(mainmenu[0].id, mainmenu[0].menu);".

any help much appreciated.

thank you.

void print (char line1, char line2)

change

void print (char line1, char* line2)

and

sprintf(temp, "%c", line2);

to

sprintf(temp, "%s", line2);

with

mainmenu[0].menu

you passing string not char function.

struct menu_id { char id; char menu[11]; <- string char submenu; };

c microcontroller mplab

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -