I am getting a segmentation fault when i try to concatenate two strings as shown in the code below:
EDITED
//global variables
char *result="hi";
char *temp;
size_t write_data(char *ptr, size_t size, size_t nmeb, void *stream)
{
temp=(char *)ptr;
while(*result)++result;
while(*result++ = *temp++);
return fwrite(ptr,size,nmeb,stream);
}
What am i doing wrong here?
Thanks