Pages: [1]   Go Down
Author Topic: String error: invalid conversion from 'const char*  (Read 1883 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

What am I doing wrong?

Thanks!!!   8-)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25899
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

You could use strcpy:
Code:
strcpy (name, "Hi Bob!");
Logged

"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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you thank you thank you!

 ;D
Logged

Pages: [1]   Go Up
Jump to: