Possible Duplicate:
Returning a string from a function in C
So I'm trying to combine element 0 of an array of cstring of a and b and return the pointer to the caller. Inside the function returnStr is set but when I assign the return from the calling function the value is now not what it should be.
char* combineCstr(char **a, char **b)
{
char *returnStr;
char str[20];
strcpy(str, a[0]);
strcat(str, "+");
strcat(str, b[0]);
returnStr= str;
return returnStr;
}
I'm thoroughly confused and any help would be appreciated, thanks.