Go Down

Topic: String error: invalid conversion from 'const char* (Read 2 times) previous topic - next topic

icarumba

Receiving the following error:
[size=10][font=Courier]invalid conversion from 'const char*' to 'char'[/font][/size]

Initializing as ( prior to setup() and loop() ):
[size=10][font=Courier]char name[12] = " ";
[/font][/size]
Later in my code, within loop():
[size=10][font=Courier]name = "Hi Bob!";[/font][/size]

What am I doing wrong?

Thanks!!!   8-)

AWOL

You can't assign a string like that in 'C':
Code: [Select]
name = "Hi Bob!";

You could use strcpy:
Code: [Select]
strcpy (name, "Hi Bob!");
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

icarumba


Go Up