c2440 problem on an easy code

Hello this is my first thread on the forum i tried to search everywhere for a solution but no result...:'(
Im trying to figure out some easy pointer use but still get some stupid error... My fault.
error C2440: '=' : cannot convert from 'char (*)[100]' to 'char'

[QUOTE=Ancient Dragon;1188748]I think you mean [b]const char *src[/b] is read-only and the compiler won't let you write to it.[/QUOTE]
No, I know what I mean, and I mean what I know.
[CODE]char *src="eretznehederet"[/CODE]
And it doesn't have anything to do with the function, but rather with the idea of the … Read More

You need to declare it like this: [icode]char src[100]="eretznehederet";[/icode] so that variable [b]src[/b] is not a pointer into read-only memory. you can change the [b]100[/b] to anything you want, as long as its large enough to hold all the text you want to put into it.
Next, at the end … Read More

line 9: remove the star -- you need to increment the pointer, not what the pointer is pointing to src++; line 15: >>*src=&temp; //c2440

You can't do that either. *src is a single character and you can not assign it a pointer to a character array temp. I don't know what you are trying to do with that line.

That entire loop is wrong. It is assigning every other character in src to every other byte in temp array. For odd numbers of i the byte in temp will just contain some junk random stuff which was on the stack then temp was allocated on the stack. I doubt that was your intent.

if i add printf("%s",temp) line 16 the output is what I want
e-r-e-t-z-n-e-h-e-d-e-r-e-t
i just need to copy temp back to src so line 9 work as it should.
line 20,21,22 is what i got from the work.
May it work if i use strcopy?

if i add printf("%s",temp) line 16 the output is what I want
e-r-e-t-z-n-e-h-e-d-e-r-e-t
i just need to copy temp back to src so line 9 work as it should.
line 20,21,22 is what i got from the work.
May it work if i use strcopy?

If you want the source string to retain the modification it can not be a read-only string.
char *src makes the string read-only. Any attempt to modify it will produce segmentation fault error.

You need to declare it like this: char src[100]="eretznehederet"; so that variable src is not a pointer into read-only memory. you can change the 100 to anything you want, as long as its large enough to hold all the text you want to put into it.

Next, at the end of that split function use strcpy() to copy the contents of temp back into src. strcpy(src,temp);

The problem is that you are trying to create a reference to a local variable and send it outside. It is not a good idea, 'cause the returned value may be corrupted in any moment. The best solution is to allocate data dynamically by calloc(). Another solution is to make the variable temp static (however, in this case each new call of this function can change the results of previous calls. You may use static char temp[100]; only for printing the result after each call or for copying it by strcopy, but not for storeing references to it).

Also, the first argument must be a pointer to pointer to char:
1. void split(char **src, char c)
.......
21. split(&src,sep);