954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C basics - incompatible error

hi,
i get an error - 'incompatible types in assignment'
for the following code

#include<stdio.h>
int main()
{
	char name[10];
	name="Hello";
	printf("%s",name);
}

Any help will be greatly appreciated...

littlewonder
Newbie Poster
4 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

You can't assign arrays.
Use strcpy() instead.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

Thanks..

littlewonder
Newbie Poster
4 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You